aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.cz>2011-02-01 18:52:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-02 19:03:18 -0500
commitfceda1bf498677501befc7da72fd2e4de7f18466 (patch)
treec23057e5368fc00b0f1c662ea9bd4b3b123c370c /mm
parentafe8a887550f7cc24eb16449670b93f6b43c32d8 (diff)
memsw: handle swapaccount kernel parameter correctly
__setup based kernel command line parameters handlers which are handled in obsolete_checksetup are provided with the parameter value including = (more precisely everything right after the parameter name). This means that the current implementation of swapaccount[=1|0] doesn't work at all because if there is a value for the parameter then we are testing for "0" resp. "1" but we are getting "=0" resp. "=1" and if there is no parameter value we are getting an empty string rather than NULL. The original noswapccount parameter, which doesn't care about the value, works correctly. Signed-off-by: Michal Hocko <mhocko@suse.cz> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3878cfe399dc..44f9f9c89f0c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5024,9 +5024,9 @@ struct cgroup_subsys mem_cgroup_subsys = {
5024static int __init enable_swap_account(char *s) 5024static int __init enable_swap_account(char *s)
5025{ 5025{
5026 /* consider enabled if no parameter or 1 is given */ 5026 /* consider enabled if no parameter or 1 is given */
5027 if (!s || !strcmp(s, "1")) 5027 if (!(*s) || !strcmp(s, "=1"))
5028 really_do_swap_account = 1; 5028 really_do_swap_account = 1;
5029 else if (!strcmp(s, "0")) 5029 else if (!strcmp(s, "=0"))
5030 really_do_swap_account = 0; 5030 really_do_swap_account = 0;
5031 return 1; 5031 return 1;
5032} 5032}
@@ -5034,7 +5034,7 @@ __setup("swapaccount", enable_swap_account);
5034 5034
5035static int __init disable_swap_account(char *s) 5035static int __init disable_swap_account(char *s)
5036{ 5036{
5037 enable_swap_account("0"); 5037 enable_swap_account("=0");
5038 return 1; 5038 return 1;
5039} 5039}
5040__setup("noswapaccount", disable_swap_account); 5040__setup("noswapaccount", disable_swap_account);