linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	lee.schermerhorn@hp.com, kosaki.motohiro@jp.fujitsu.com,
	miaox@cn.fujitsu.com, mingo@elte.hu, a.p.zijlstra@chello.nl,
	cl@linux-foundation.org, menage@google.com,
	nickpiggin@yahoo.com.au, y-goto@jp.fujitsu.com,
	penberg@cs.helsinki.fi, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [BUG] set_mempolicy(MPOL_INTERLEAV) cause kernel panic
Date: Sat, 25 Jul 2009 11:35:54 +0900 (JST)	[thread overview]
Message-ID: <5bb65c0e4c6828b1331d33745f34d9ee.squirrel@webmail-b.css.fujitsu.com> (raw)
In-Reply-To: <337c5d83954b38b14a17f0adf4d357d8.squirrel@webmail-b.css.fujitsu.com>

KAMEZAWA Hiroyuki wrote:
> Andrew Morton wrote:
>> On Fri, 24 Jul 2009 15:51:51 -0700 (PDT)
>> David Rientjes <rientjes@google.com> wrote:
>
>> afaik we don't have a final patch for this.  I asked Motohiro-san about
>> this and he's proposing that we revert the offending change (which one
>> was it?) if nothing gets fixed soon - the original author is on a
>> lengthy vacation.
>>
>>
>> If we _do_ have a patch then can we start again?  Someone send out the
>> patch
>> and let's take a look at it.
> Hmm, like this ? (cleaned up David's one because we shouldn't have
> extra nodemask_t on stack.)
>
> Problems are
>   - rebind() is maybe broken but no good idea.
>    (but it seems to be broken in old kernels
>   - Who can test this is only a user who has possible node on SRAT.
>

> +		/* should we call is_valid_nodemask() here ?*/
>  		if (pol->flags & MPOL_F_RELATIVE_NODES)
>  			mpol_relative_nodemask(&cpuset_context_nmask, nodes,
> -					       &cpuset_current_mems_allowed);
> +					       &cpuset_context_nmask);
Sorry this part is buggy.

But to fix this, we use extra nodemask here and this patch will
allocate 3 nodemasks on stack!
Then, here is a much easier fix. for trusting cpuset more.

==
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

task->mems_allowed is guaranteed to be only includes valid nodes when
it is set under cpuset. but, at init, all possible nodes are included.
fix it.

And at cpuset-rebind, caluculated result can be a invaild one.
In that case, trust cpuset's one

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 init/main.c    |    4 ++--
 mm/mempolicy.c |    7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

Index: mmotm-2.6.31-Jul16/init/main.c
===================================================================
--- mmotm-2.6.31-Jul16.orig/init/main.c
+++ mmotm-2.6.31-Jul16/init/main.c
@@ -855,9 +855,9 @@ static int __init kernel_init(void * unu
 	lock_kernel();

 	/*
-	 * init can allocate pages on any node
+	 * init can allocate pages on any online node
 	 */
-	set_mems_allowed(node_possible_map);
+	set_mems_allowed(node_state[N_HIGH_MEMORY]);
 	/*
 	 * init can run on any cpu.
 	 */
Index: mmotm-2.6.31-Jul16/mm/mempolicy.c
===================================================================
--- mmotm-2.6.31-Jul16.orig/mm/mempolicy.c
+++ mmotm-2.6.31-Jul16/mm/mempolicy.c
@@ -290,7 +290,12 @@ static void mpol_rebind_nodemask(struct
 			    *nodes);
 		pol->w.cpuset_mems_allowed = *nodes;
 	}
-
+	/*
+	 * tmp can be invalid ...just use cpuset's one in that case.
+	 */
+	if (nodes_empty(tmp) ||
+	    ((pol->mode == MPOL_BIND) && !is_valid_nodemask(&tmp)))
+		tmp = *nodes;
 	pol->v.nodes = tmp;
 	if (!node_isset(current->il_next, tmp)) {
 		current->il_next = next_node(current->il_next, tmp);





--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-07-25  2:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15  9:48 [BUG] set_mempolicy(MPOL_INTERLEAV) cause kernel panic KOSAKI Motohiro
2009-07-15 17:31 ` Lee Schermerhorn
2009-07-16  1:00   ` KOSAKI Motohiro
2009-07-16 20:05   ` David Rientjes
2009-07-17  0:04     ` KOSAKI Motohiro
2009-07-17  0:57       ` KAMEZAWA Hiroyuki
2009-07-17  2:07         ` KOSAKI Motohiro
2009-07-17  2:39           ` KAMEZAWA Hiroyuki
2009-07-17  9:09         ` David Rientjes
2009-07-17  9:01       ` David Rientjes
2009-07-24 22:51     ` David Rientjes
2009-07-24 23:09       ` Andrew Morton
2009-07-25  1:33         ` KAMEZAWA Hiroyuki
2009-07-25  2:35           ` KAMEZAWA Hiroyuki [this message]
2009-07-25  3:15             ` KAMEZAWA Hiroyuki
2009-07-25 13:21               ` KOSAKI Motohiro
2009-07-25 14:40                 ` KAMEZAWA Hiroyuki
2009-07-27 18:00                   ` David Rientjes
2009-07-27 17:55               ` David Rientjes
2009-07-27 23:58                 ` KAMEZAWA Hiroyuki
2009-07-28  0:14                   ` David Rientjes
2009-07-28  0:25                     ` KAMEZAWA Hiroyuki
2009-07-28  0:38                       ` David Rientjes
2009-07-28  0:54                         ` KAMEZAWA Hiroyuki
2009-07-28  1:02                           ` David Rientjes
2009-07-28  1:11                             ` KAMEZAWA Hiroyuki
2009-07-28  1:24                               ` KAMEZAWA Hiroyuki
2009-07-28  7:18 ` [BUGFIX] set_mempolicy(MPOL_INTERLEAV) N_HIGH_MEMORY aware KAMEZAWA Hiroyuki
2009-07-28  8:52   ` Andi Kleen
2009-07-28 10:04     ` KAMEZAWA Hiroyuki
2009-07-29 20:16   ` Andrew Morton
2009-07-30  0:06     ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5bb65c0e4c6828b1331d33745f34d9ee.squirrel@webmail-b.css.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=menage@google.com \
    --cc=miaox@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=penberg@cs.helsinki.fi \
    --cc=rientjes@google.com \
    --cc=y-goto@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).