aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swap_state.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2008-07-25 22:45:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 15:00:06 -0400
commit19fd6231279be3c3bdd02ed99f9b0eb195978064 (patch)
treeee09121054262d73c551b57114acd855b82a7a82 /mm/swap_state.c
parenta60637c85893e7191faaafa6a72e197c24386727 (diff)
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>
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r--mm/swap_state.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 3e3381d6c7ee..2c217e33d497 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -39,7 +39,7 @@ static struct backing_dev_info swap_backing_dev_info = {
39 39
40struct address_space swapper_space = { 40struct address_space swapper_space = {
41 .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), 41 .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN),
42 .tree_lock = __RW_LOCK_UNLOCKED(swapper_space.tree_lock), 42 .tree_lock = __SPIN_LOCK_UNLOCKED(swapper_space.tree_lock),
43 .a_ops = &swap_aops, 43 .a_ops = &swap_aops,
44 .i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear), 44 .i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear),
45 .backing_dev_info = &swap_backing_dev_info, 45 .backing_dev_info = &swap_backing_dev_info,
@@ -80,7 +80,7 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
80 SetPageSwapCache(page); 80 SetPageSwapCache(page);
81 set_page_private(page, entry.val); 81 set_page_private(page, entry.val);
82 82
83 write_lock_irq(&swapper_space.tree_lock); 83 spin_lock_irq(&swapper_space.tree_lock);
84 error = radix_tree_insert(&swapper_space.page_tree, 84 error = radix_tree_insert(&swapper_space.page_tree,
85 entry.val, page); 85 entry.val, page);
86 if (likely(!error)) { 86 if (likely(!error)) {
@@ -88,7 +88,7 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
88 __inc_zone_page_state(page, NR_FILE_PAGES); 88 __inc_zone_page_state(page, NR_FILE_PAGES);
89 INC_CACHE_INFO(add_total); 89 INC_CACHE_INFO(add_total);
90 } 90 }
91 write_unlock_irq(&swapper_space.tree_lock); 91 spin_unlock_irq(&swapper_space.tree_lock);
92 radix_tree_preload_end(); 92 radix_tree_preload_end();
93 93
94 if (unlikely(error)) { 94 if (unlikely(error)) {
@@ -182,9 +182,9 @@ void delete_from_swap_cache(struct page *page)
182 182
183 entry.val = page_private(page); 183 entry.val = page_private(page);
184 184
185 write_lock_irq(&swapper_space.tree_lock); 185 spin_lock_irq(&swapper_space.tree_lock);
186 __delete_from_swap_cache(page); 186 __delete_from_swap_cache(page);
187 write_unlock_irq(&swapper_space.tree_lock); 187 spin_unlock_irq(&swapper_space.tree_lock);
188 188
189 swap_free(entry); 189 swap_free(entry);
190 page_cache_release(page); 190 page_cache_release(page);