diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-06-17 19:27:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-18 16:03:47 -0400 |
commit | 338c843108bf5030d6765f4405126e70f8b77845 (patch) | |
tree | c3bdab2f288e4c5a843ea07e0f8938a821ab848a /mm/memcontrol.c | |
parent | 302362c5abdda80b5c2e4e57be610c2e3c2ab3c5 (diff) |
memcg: remove some redundant checks
We don't need to check do_swap_account in the case that the function which
checks do_swap_account will never get called if do_swap_account == 0.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 11 |
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 */ |
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(); |