aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c11
1 files changed, 4 insertions, 7 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 */
49int do_swap_account __read_mostly; 49int do_swap_account __read_mostly;
50static int really_do_swap_account __initdata = 1; /* for remember boot option*/ 50static 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
1766int mem_cgroup_resize_memsw_limit(struct mem_cgroup *memcg, 1766static 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();