#include <linux/backing-dev.h>
#include <linux/pagevec.h>
#include <linux/migrate.h>
-#include <linux/memcontrol.h>
#include <asm/pgtable.h>
BUG_ON(!PageLocked(page));
BUG_ON(PageSwapCache(page));
BUG_ON(PagePrivate(page));
-
- error = mem_cgroup_cache_charge(page, current->mm, gfp_mask);
- if (error)
- goto out;
-
error = radix_tree_preload(gfp_mask);
if (!error) {
write_lock_irq(&swapper_space.tree_lock);
total_swapcache_pages++;
__inc_zone_page_state(page, NR_FILE_PAGES);
INC_CACHE_INFO(add_total);
- } else {
- mem_cgroup_uncharge_page(page);
}
write_unlock_irq(&swapper_space.tree_lock);
radix_tree_preload_end();
- } else
- mem_cgroup_uncharge_page(page);
-out:
+ }
return error;
}
BUG_ON(PageWriteback(page));
BUG_ON(PagePrivate(page));
- mem_cgroup_uncharge_page(page);
radix_tree_delete(&swapper_space.page_tree, page_private(page));
set_page_private(page, 0);
ClearPageSwapCache(page);