[Bug 239672] gcov: Optimize list traverse by using LIST_FOREACH_SAFE

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Aug 7 01:59:53 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239672

Conrad Meyer <cem at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cem at freebsd.org

--- Comment #1 from Conrad Meyer <cem at freebsd.org> ---
This change is not correct.  Nodes are actually in a tree topology and
remove_node() will release parent nodes as it goes, potentially invalidating
the traverse (even with FOREACH_SAFE).

The code could be refactored to mark removed nodes as a first pass, and then
remove them in a second pass (with plain TAILQ_FOREACH_SAFE).  This alternative
would avoid wasted work for nodes that are never removed (which is probably the
goal of the proposed change), but not break the algorithm.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list