mm: spinlock tree_lock

mapping->tree_lock has no read lockers.  convert the lock from an rwlock
to a spinlock.

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]>
This commit is contained in:
Nick Piggin 2008-07-25 19:45:32 -07:00 • committed by Linus Torvalds
commit 19fd623127
12 changed files with 38 additions and 39 deletions

View file

@ -399,7 +399,7 @@ static int __remove_mapping(struct address_space *mapping, struct page *page)
BUG_ON(!PageLocked(page));
BUG_ON(mapping != page_mapping(page));
write_lock_irq(&mapping->tree_lock);
spin_lock_irq(&mapping->tree_lock);
/*
* The non racy check for a busy page.
*
@ -436,17 +436,17 @@ static int __remove_mapping(struct address_space *mapping, struct page *page)
if (PageSwapCache(page)) {
swp_entry_t swap = { .val = page_private(page) };
__delete_from_swap_cache(page);
write_unlock_irq(&mapping->tree_lock);
spin_unlock_irq(&mapping->tree_lock);
swap_free(swap);
} else {
__remove_from_page_cache(page);
write_unlock_irq(&mapping->tree_lock);
spin_unlock_irq(&mapping->tree_lock);
}
return 1;
cannot_free:
write_unlock_irq(&mapping->tree_lock);
spin_unlock_irq(&mapping->tree_lock);
return 0;
}