diff options
-rw-r--r-- | mm/memcontrol.c | 11 | ||||
-rw-r--r-- | mm/page_cgroup.c | 8 |
2 files changed, 4 insertions, 15 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 6f682901deb5..3468c38adde6 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -45,7 +45,7 @@ struct cgroup_subsys mem_cgroup_subsys __read_mostly; | |||
45 | #define MEM_CGROUP_RECLAIM_RETRIES 5 | 45 | #define MEM_CGROUP_RECLAIM_RETRIES 5 |
46 | 46 | ||
47 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 47 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
48 | /* Turned on only when memory cgroup is enabled && really_do_swap_account = 0 */ | 48 | /* Turned on only when memory cgroup is enabled && really_do_swap_account = 1 */ |
49 | int do_swap_account __read_mostly; | 49 | int do_swap_account __read_mostly; |
50 | static int really_do_swap_account __initdata = 1; /* for remember boot option*/ | 50 | static int really_do_swap_account __initdata = 1; /* for remember boot option*/ |
51 | #else | 51 | #else |
@@ -1763,16 +1763,14 @@ static int mem_cgroup_resize_limit(struct mem_cgroup *memcg, | |||
1763 | return ret; | 1763 | return ret; |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | int mem_cgroup_resize_memsw_limit(struct mem_cgroup *memcg, | 1766 | static int mem_cgroup_resize_memsw_limit(struct mem_cgroup *memcg, |
1767 | unsigned long long val) | 1767 | unsigned long long val) |
1768 | { | 1768 | { |
1769 | int retry_count; | 1769 | int retry_count; |
1770 | u64 memlimit, oldusage, curusage; | 1770 | u64 memlimit, oldusage, curusage; |
1771 | int children = mem_cgroup_count_children(memcg); | 1771 | int children = mem_cgroup_count_children(memcg); |
1772 | int ret = -EBUSY; | 1772 | int ret = -EBUSY; |
1773 | 1773 | ||
1774 | if (!do_swap_account) | ||
1775 | return -EINVAL; | ||
1776 | /* see mem_cgroup_resize_res_limit */ | 1774 | /* see mem_cgroup_resize_res_limit */ |
1777 | retry_count = children * MEM_CGROUP_RECLAIM_RETRIES; | 1775 | retry_count = children * MEM_CGROUP_RECLAIM_RETRIES; |
1778 | oldusage = res_counter_read_u64(&memcg->memsw, RES_USAGE); | 1776 | oldusage = res_counter_read_u64(&memcg->memsw, RES_USAGE); |
@@ -2007,8 +2005,7 @@ static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft) | |||
2007 | val = res_counter_read_u64(&mem->res, name); | 2005 | val = res_counter_read_u64(&mem->res, name); |
2008 | break; | 2006 | break; |
2009 | case _MEMSWAP: | 2007 | case _MEMSWAP: |
2010 | if (do_swap_account) | 2008 | val = res_counter_read_u64(&mem->memsw, name); |
2011 | val = res_counter_read_u64(&mem->memsw, name); | ||
2012 | break; | 2009 | break; |
2013 | default: | 2010 | default: |
2014 | BUG(); | 2011 | BUG(); |
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index 672089d5819f..f22b4ebbd8dc 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c | |||
@@ -311,8 +311,6 @@ static int swap_cgroup_prepare(int type) | |||
311 | struct swap_cgroup_ctrl *ctrl; | 311 | struct swap_cgroup_ctrl *ctrl; |
312 | unsigned long idx, max; | 312 | unsigned long idx, max; |
313 | 313 | ||
314 | if (!do_swap_account) | ||
315 | return 0; | ||
316 | ctrl = &swap_cgroup_ctrl[type]; | 314 | ctrl = &swap_cgroup_ctrl[type]; |
317 | 315 | ||
318 | for (idx = 0; idx < ctrl->length; idx++) { | 316 | for (idx = 0; idx < ctrl->length; idx++) { |
@@ -349,9 +347,6 @@ unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) | |||
349 | struct swap_cgroup *sc; | 347 | struct swap_cgroup *sc; |
350 | unsigned short old; | 348 | unsigned short old; |
351 | 349 | ||
352 | if (!do_swap_account) | ||
353 | return 0; | ||
354 | |||
355 | ctrl = &swap_cgroup_ctrl[type]; | 350 | ctrl = &swap_cgroup_ctrl[type]; |
356 | 351 | ||
357 | mappage = ctrl->map[idx]; | 352 | mappage = ctrl->map[idx]; |
@@ -380,9 +375,6 @@ unsigned short lookup_swap_cgroup(swp_entry_t ent) | |||
380 | struct swap_cgroup *sc; | 375 | struct swap_cgroup *sc; |
381 | unsigned short ret; | 376 | unsigned short ret; |
382 | 377 | ||
383 | if (!do_swap_account) | ||
384 | return 0; | ||
385 | |||
386 | ctrl = &swap_cgroup_ctrl[type]; | 378 | ctrl = &swap_cgroup_ctrl[type]; |
387 | mappage = ctrl->map[idx]; | 379 | mappage = ctrl->map[idx]; |
388 | sc = page_address(mappage); | 380 | sc = page_address(mappage); |