1
0
Fork 0
alistair23-linux/arch
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
..
alpha Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
arc Merge branch 'linus' into locking/core, to pick up fixes 2016-12-11 13:07:13 +01:00
arm mm: remove the page size change check in tlb_remove_page 2016-12-12 18:55:07 -08:00
arm64 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
avr32 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
blackfin locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
c6x locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
cris Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
frv Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
h8300 locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
hexagon locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
ia64 mm: remove the page size change check in tlb_remove_page 2016-12-12 18:55:07 -08:00
m32r m32r: fix build warning 2016-12-12 18:55:06 -08:00
m68k Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
metag locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
microblaze locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
mips Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
mn10300 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
nios2 Merge branch 'linus' into locking/core, to pick up fixes 2016-11-22 12:37:38 +01:00
openrisc Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
parisc Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
powerpc powerpc/mm: allow memory hotplug into a memoryless node 2016-12-12 18:55:07 -08:00
s390 lib: radix-tree: check accounting of existing slot replacement users 2016-12-12 18:55:08 -08:00
score locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
sh mm: remove the page size change check in tlb_remove_page 2016-12-12 18:55:07 -08:00
sparc Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
tile Merge branch 'locking/urgent' into locking/core, to pick up dependent fixes 2016-12-02 11:13:44 +01:00
um mm: remove the page size change check in tlb_remove_page 2016-12-12 18:55:07 -08:00
unicore32 locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
x86 mm: remove x86-only restriction of movable_node 2016-12-12 18:55:07 -08:00
xtensa Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
.gitignore
Kconfig Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 12:15:10 -08:00