On Mon, 19 May 2025 at 14:35, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > What trim_one(A) does instead is > * note that A itself needs to be removed > * remove B and D Yeah, I wondered, but it wasn't obvious from the flow that the same list was getting changed... But now that you point it out, it's fairly obvious in trim_one -> trim_ancestors -> remove_candidate(). I did see the direct call to remove_candidate(), but that only affected 'A' itself. And I guess passing the list head around wouldn't have helped make that flow more obvious, because the removal is through the list head, it's just that list_del_init() on the list entry. A comment may have helped, just because I found that list traversal pattern so odd. But yes > [..] Then the loop would turn into > > while !empty(candidates) > trim_one(first candidate) would have made me not think it's oddly written. Linus