diff options
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r-- | mm/swap_state.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c index 581b609e748d..6ce0669acedc 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
@@ -75,13 +75,13 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask) | |||
75 | BUG_ON(!PageLocked(page)); | 75 | BUG_ON(!PageLocked(page)); |
76 | BUG_ON(PageSwapCache(page)); | 76 | BUG_ON(PageSwapCache(page)); |
77 | BUG_ON(PagePrivate(page)); | 77 | BUG_ON(PagePrivate(page)); |
78 | error = radix_tree_preload(gfp_mask); | ||
79 | if (!error) { | ||
80 | 78 | ||
81 | error = mem_cgroup_cache_charge(page, current->mm, gfp_mask); | 79 | error = mem_cgroup_cache_charge(page, current->mm, gfp_mask); |
82 | if (error) | 80 | if (error) |
83 | goto out; | 81 | goto out; |
84 | 82 | ||
83 | error = radix_tree_preload(gfp_mask); | ||
84 | if (!error) { | ||
85 | write_lock_irq(&swapper_space.tree_lock); | 85 | write_lock_irq(&swapper_space.tree_lock); |
86 | error = radix_tree_insert(&swapper_space.page_tree, | 86 | error = radix_tree_insert(&swapper_space.page_tree, |
87 | entry.val, page); | 87 | entry.val, page); |
@@ -97,7 +97,8 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask) | |||
97 | } | 97 | } |
98 | write_unlock_irq(&swapper_space.tree_lock); | 98 | write_unlock_irq(&swapper_space.tree_lock); |
99 | radix_tree_preload_end(); | 99 | radix_tree_preload_end(); |
100 | } | 100 | } else |
101 | mem_cgroup_uncharge_page(page); | ||
101 | out: | 102 | out: |
102 | return error; | 103 | return error; |
103 | } | 104 | } |