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 <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>
This commit is contained in:
Nick Piggin
2008-07-25 19:45:32 -07:00
committed by Linus Torvalds
parent a60637c858
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;
}