Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1240774 > unrolled thread
| Started by | Tejun Heo <tj@kernel.org> |
|---|---|
| First post | 2015-10-06 19:30 +0200 |
| Last post | 2015-10-06 19:30 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] rbtree: clarify documentation of rbtree_postorder_for_each_entry_safe() Tejun Heo <tj@kernel.org> - 2015-10-06 19:30 +0200
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2015-10-06 19:30 +0200 |
| Subject | Re: [PATCH] rbtree: clarify documentation of rbtree_postorder_for_each_entry_safe() |
| Message-ID | <qgEdP-4lc-3@gated-at.bofh.it> |
Hello, On Sun, Oct 04, 2015 at 06:32:50PM -0400, Cody P Schafer wrote: > Doing this will cause random nodes to be missed by the iteration because > rb_erase() may rebalance the tree, changing the ordering that we're > trying to iterate over. > > The previous documentation for rbtree_postorder_for_each_entry_safe() > wasn't clear that this wasn't allowed, it was taken from the docs for > list_for_each_entry_safe(), where erasing isn't a problem due to > list_del() not reordering. Ugh... that's a misleading name for an iterator if it doesn't allow removal of elements during iteration. > Explicitly warn developers about this potential pit-fall. > > Note that I haven't fixed the actual issue that (it appears) the commit > referenced above introduced (not familiar enough with that code). > > In general (and in this case), the patterns to follow are: > - switch to rb_first() + rb_erase(), don't use > rbtree_postorder_for_each_entry_safe(). I'll update it to a while loop on rb_first(). Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web