Skip to content

Commit

Permalink
mm: readahead scan lockless
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Reviewed-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Nick Piggin authored and torvalds committed Jul 26, 2008
1 parent 652ea69 commit 30002ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/readahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ ondemand_readahead(struct address_space *mapping,
if (hit_readahead_marker) {
pgoff_t start;

read_lock_irq(&mapping->tree_lock);
start = radix_tree_next_hole(&mapping->page_tree, offset, max+1);
read_unlock_irq(&mapping->tree_lock);
rcu_read_lock();
start = radix_tree_next_hole(&mapping->page_tree, offset,max+1);
rcu_read_unlock();

if (!start || start - offset > max)
return 0;
Expand Down

0 comments on commit 30002ed

Please sign in to comment.