aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swap_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r--mm/swap_state.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 6ce0669acedc..ec42f01a8d02 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -17,7 +17,6 @@
17#include <linux/backing-dev.h> 17#include <linux/backing-dev.h>
18#include <linux/pagevec.h> 18#include <linux/pagevec.h>
19#include <linux/migrate.h> 19#include <linux/migrate.h>
20#include <linux/memcontrol.h>
21 20
22#include <asm/pgtable.h> 21#include <asm/pgtable.h>
23 22
@@ -75,11 +74,6 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
75 BUG_ON(!PageLocked(page)); 74 BUG_ON(!PageLocked(page));
76 BUG_ON(PageSwapCache(page)); 75 BUG_ON(PageSwapCache(page));
77 BUG_ON(PagePrivate(page)); 76 BUG_ON(PagePrivate(page));
78
79 error = mem_cgroup_cache_charge(page, current->mm, gfp_mask);
80 if (error)
81 goto out;
82
83 error = radix_tree_preload(gfp_mask); 77 error = radix_tree_preload(gfp_mask);
84 if (!error) { 78 if (!error) {
85 write_lock_irq(&swapper_space.tree_lock); 79 write_lock_irq(&swapper_space.tree_lock);
@@ -92,14 +86,10 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
92 total_swapcache_pages++; 86 total_swapcache_pages++;
93 __inc_zone_page_state(page, NR_FILE_PAGES); 87 __inc_zone_page_state(page, NR_FILE_PAGES);
94 INC_CACHE_INFO(add_total); 88 INC_CACHE_INFO(add_total);
95 } else {
96 mem_cgroup_uncharge_page(page);
97 } 89 }
98 write_unlock_irq(&swapper_space.tree_lock); 90 write_unlock_irq(&swapper_space.tree_lock);
99 radix_tree_preload_end(); 91 radix_tree_preload_end();
100 } else 92 }
101 mem_cgroup_uncharge_page(page);
102out:
103 return error; 93 return error;
104} 94}
105 95
@@ -114,7 +104,6 @@ void __delete_from_swap_cache(struct page *page)
114 BUG_ON(PageWriteback(page)); 104 BUG_ON(PageWriteback(page));
115 BUG_ON(PagePrivate(page)); 105 BUG_ON(PagePrivate(page));
116 106
117 mem_cgroup_uncharge_page(page);
118 radix_tree_delete(&swapper_space.page_tree, page_private(page)); 107 radix_tree_delete(&swapper_space.page_tree, page_private(page));
119 set_page_private(page, 0); 108 set_page_private(page, 0);
120 ClearPageSwapCache(page); 109 ClearPageSwapCache(page);