linux/tools/testing/radix-tree
Johannes Weiner 6d75f366b9 lib: radix-tree: check accounting of existing slot replacement users
The bug in khugepaged fixed earlier in this series shows that radix tree
slot replacement is fragile; and it will become more so when not only
NULL<->!NULL transitions need to be caught but transitions from and to
exceptional entries as well.  We need checks.

Re-implement radix_tree_replace_slot() on top of the sanity-checked
__radix_tree_replace().  This requires existing callers to also pass the
radix tree root, but it'll warn us when somebody replaces slots with
contents that need proper accounting (transitions between NULL entries,
real entries, exceptional entries) and where a replacement through the
slot pointer would corrupt the radix tree node counts.

Link: http://lkml.kernel.org/r/20161117193021.GB23430@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox <mawilcox@linuxonhyperv.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-12 18:55:08 -08:00
..
generated radix-tree: add support for multi-order iterating 2016-05-20 17:58:30 -07:00
linux Revert "radix tree test suite: fix compilation" 2016-12-09 10:41:42 -08:00
.gitignore
find_next_bit.c
iteration_check.c radix-tree tests: add iteration test 2016-10-11 15:06:30 -07:00
linux.c
main.c radix-tree tests: add iteration test 2016-10-11 15:06:30 -07:00
Makefile radix-tree tests: add iteration test 2016-10-11 15:06:30 -07:00
multiorder.c lib: radix-tree: check accounting of existing slot replacement users 2016-12-12 18:55:08 -08:00
rcupdate.c
regression.h radix-tree tests: add regression3 test 2016-03-17 15:09:34 -07:00
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 tests: add test for radix_tree_iter_next 2016-03-17 15:09:34 -07:00
tag_check.c testing/radix-tree: fix a macro expansion bug 2016-07-23 10:25:54 +09:00
test.c radix-tree: rename radix_tree_is_indirect_ptr() 2016-05-20 17:58:30 -07:00
test.h radix-tree tests: add iteration test 2016-10-11 15:06:30 -07:00