Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: readahead scan lockless

radix_tree_next_hole() is implemented as a series of radix_tree_lookup()s.
So it can be called locklessly, under rcu_read_lock().

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Reviewed-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Nick Piggin and committed by
Linus Torvalds
30002ed2 652ea695

+3 -3
+3 -3
mm/readahead.c
··· 382 382 if (hit_readahead_marker) { 383 383 pgoff_t start; 384 384 385 - read_lock_irq(&mapping->tree_lock); 386 - start = radix_tree_next_hole(&mapping->page_tree, offset, max+1); 387 - read_unlock_irq(&mapping->tree_lock); 385 + rcu_read_lock(); 386 + start = radix_tree_next_hole(&mapping->page_tree, offset,max+1); 387 + rcu_read_unlock(); 388 388 389 389 if (!start || start - offset > max) 390 390 return 0;