linux/tools/testing/radix-tree
Matthew Wilcox 148deab223 radix-tree: improve multiorder iterators
This fixes several interlinked problems with the iterators in the
presence of multiorder entries.

1. radix_tree_iter_next() would only advance by one slot, which would
   result in the iterators returning the same entry more than once if
   there were sibling entries.

2. radix_tree_next_slot() could return an internal pointer instead of
   a user pointer if a tagged multiorder entry was immediately followed by
   an entry of lower order.

3. radix_tree_next_slot() expanded to a lot more code than it used to
   when multiorder support was compiled in.  And I wasn't comfortable with
   entry_to_node() being in a header file.

Fixing radix_tree_iter_next() for the presence of sibling entries
necessarily involves examining the contents of the radix tree, so we now
need to pass 'slot' to radix_tree_iter_next(), and we need to change the
calling convention so it is called *before* dropping the lock which
protects the tree.  Also rename it to radix_tree_iter_resume(), as some
people thought it was necessary to call radix_tree_iter_next() each time
around the loop.

radix_tree_next_slot() becomes closer to how it looked before multiorder
support was introduced.  It only checks to see if the next entry in the
chunk is a sibling entry or a pointer to a node; this should be rare
enough that handling this case out of line is not a performance impact
(and such impact is amortised by the fact that the entry we just
processed was a multiorder entry).  Also, radix_tree_next_slot() used to
force a new chunk lookup for untagged entries, which is more expensive
than the out of line sibling entry skipping.

Link: http://lkml.kernel.org/r/1480369871-5271-55-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-14 16:04:10 -08:00
..
generated radix-tree: add support for multi-order iterating 2016-05-20 17:58:30 -07:00
linux radix tree test suite: use common find-bit code 2016-12-14 16:04:10 -08:00
.gitignore
benchmark.c radix tree test suite: benchmark for iterator 2016-12-14 16:04:09 -08:00
iteration_check.c radix-tree: improve multiorder iterators 2016-12-14 16:04:10 -08:00
linux.c radix tree test suite: track preempt_count 2016-12-14 16:04:09 -08:00
main.c radix tree test suite: use rcu_barrier 2016-12-14 16:04:09 -08:00
Makefile radix tree test suite: use common find-bit code 2016-12-14 16:04:10 -08:00
multiorder.c radix-tree: improve multiorder iterators 2016-12-14 16:04:10 -08:00
rcupdate.c
regression1.c radix-tree tests: properly initialize mutex 2016-10-11 15:06:30 -07:00
regression2.c radix tree test suite: allow testing other fan-out values 2016-05-20 17:58:30 -07:00
regression3.c radix-tree: improve multiorder iterators 2016-12-14 16:04:10 -08:00
regression.h radix-tree tests: add regression3 test 2016-03-17 15:09:34 -07:00
tag_check.c radix tree test suite: use rcu_barrier 2016-12-14 16:04:09 -08:00
test.c radix tree test suite: record order in each item 2016-12-14 16:04:10 -08:00
test.h radix-tree: improve multiorder iterators 2016-12-14 16:04:10 -08:00