All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memsw: handle swapaccount kernel parameter correctly
@ 2011-01-26 15:21 ` Michal Hocko
  0 siblings, 0 replies; 18+ messages in thread
From: Michal Hocko @ 2011-01-26 15:21 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, balbir, KAMEZAWA Hiroyuki,
	Daisuke Nishimura, stable

Hi Andrew,
I am sorry but the patch which added swapaccount parameter is not
correct (we have discussed it https://lkml.org/lkml/2010/11/16/103).
I didn't get the way how __setup parameters are handled correctly.
The patch bellow fixes that.

I am CCing stable as well because the patch got into .37 kernel.

---
>From 144c2e8aed27d82d48217896ee1f58dbaa7f1f84 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@suse.cz>
Date: Wed, 26 Jan 2011 14:12:41 +0100
Subject: [PATCH] memsw: handle swapaccount kernel parameter correctly

__setup based kernel command line parameters handled in
obsolete_checksetup provides the parameter value including = (more
precisely everything right after the parameter name) so we have to check
for =0 resp. =1 here. If no value is given then we get an empty string
rather then NULL.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
---
 mm/memcontrol.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index db76ef7..cea2be48 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5013,9 +5013,9 @@ struct cgroup_subsys mem_cgroup_subsys = {
 static int __init enable_swap_account(char *s)
 {
 	/* consider enabled if no parameter or 1 is given */
-	if (!s || !strcmp(s, "1"))
+	if (!(*s) || !strcmp(s, "=1"))
 		really_do_swap_account = 1;
-	else if (!strcmp(s, "0"))
+	else if (!strcmp(s, "=0"))
 		really_do_swap_account = 0;
 	return 1;
 }
@@ -5023,7 +5023,7 @@ __setup("swapaccount", enable_swap_account);
 
 static int __init disable_swap_account(char *s)
 {
-	enable_swap_account("0");
+	enable_swap_account("=0");
 	return 1;
 }
 __setup("noswapaccount", disable_swap_account);
-- 
1.7.2.3

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-01-28  8:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 15:21 [PATCH] memsw: handle swapaccount kernel parameter correctly Michal Hocko
2011-01-26 15:21 ` Michal Hocko
2011-01-26 22:06 ` Andrew Morton
2011-01-26 22:06   ` Andrew Morton
2011-01-27  8:23   ` Michal Hocko
2011-01-27  8:23     ` Michal Hocko
2011-01-27  9:03     ` KAMEZAWA Hiroyuki
2011-01-27  9:03       ` KAMEZAWA Hiroyuki
2011-01-27  9:29       ` Michal Hocko
2011-01-27  9:29         ` Michal Hocko
2011-01-27  9:48         ` KAMEZAWA Hiroyuki
2011-01-27  9:48           ` KAMEZAWA Hiroyuki
2011-01-27 10:47           ` [PATCH] memsw: Deprecate noswapaccount kernel parameter and schedule it for removal Michal Hocko
2011-01-27 10:47             ` Michal Hocko
2011-01-27 23:37             ` KAMEZAWA Hiroyuki
2011-01-27 23:37               ` KAMEZAWA Hiroyuki
2011-01-28  8:03               ` Michal Hocko
2011-01-28  8:03                 ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.