All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm <linux-mm@kvack.org>,
	linux-numa <linux-numa@vger.kernel.org>,
	miaox@cn.fujitsu.com, Mel Gorman <mel@csn.ul.ie>,
	Doug Chapman <doug.chapman@hp.com>,
	Eric Whitney <eric.whitney@hp.com>,
	Bjorn Helgaas <bjorn.helgaas@hp.com>
Subject: [PATCH] Limit initial tasks' and top level cpuset's mems_allowed to nodes with memory
Date: Sun, 03 May 2009 23:06:04 -0400	[thread overview]
Message-ID: <1241406364.9211.18.camel@lts-notebook> (raw)


Against:  2.6.20-rc3-mmotm-090428-1631

Since cpusetmm-update-tasks-mems_allowed-in-time.patch removed the call outs
to cpuset_update_task_memory_state(), tasks in the top cpuset don't get their
mems_allowed updated to just nodes with memory.  cpuset_init()initializes
the top cpuset's mems_allowed with nodes_setall() and 
cpuset_init_current_mems_allowed() and kernel_init() initialize the kernel
initialization tasks' mems_allowed to all possible nodes.  Tasks in the top
cpuset that inherit the init task's mems_allowed without modification will
have all possible nodes set.  This can be seen by examining the Mems_allowed
field in /proc/<pid>/status in such a task.

"numactl --interleave=all" also initializes the interleave node mask to all
ones, depending on the masking with mems_allowed to eliminate non-existent
nodes and nodes without memory.  As this was not happening, the interleave
policy was attempting to dereference non-existent nodes.

This patch modifies the nodes_setall() calls in two cpuset init functions and
the initialization of task #1's mems_allowed to use node_states[N_HIGH_MEMORY]. 
This mask has been initialized to contain only existing nodes with memory by
the time the respective init functions are called.

This fixes the bogus pointer deref [Nat Consumption fault on ia64] reported
in:

	[BUG] 2.6.30-rc3-mmotm-090428-1814 -- bogus pointer deref

[The time--1814--was incorrect in that subject line, but the date was correct.]

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>

 init/main.c     |    4 ++--
 kernel/cpuset.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.30-rc3-mmotm-090428-1631/kernel/cpuset.c
===================================================================
--- linux-2.6.30-rc3-mmotm-090428-1631.orig/kernel/cpuset.c	2009-05-03 18:26:24.000000000 -0400
+++ linux-2.6.30-rc3-mmotm-090428-1631/kernel/cpuset.c	2009-05-03 20:46:04.000000000 -0400
@@ -1846,7 +1846,7 @@ int __init cpuset_init(void)
 		BUG();
 
 	cpumask_setall(top_cpuset.cpus_allowed);
-	nodes_setall(top_cpuset.mems_allowed);
+	top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
 
 	fmeter_init(&top_cpuset.fmeter);
 	set_bit(CS_SCHED_LOAD_BALANCE, &top_cpuset.flags);
@@ -2118,7 +2118,7 @@ void cpuset_cpus_allowed_locked(struct t
 
 void cpuset_init_current_mems_allowed(void)
 {
-	nodes_setall(current->mems_allowed);
+	current->mems_allowed = node_states[N_HIGH_MEMORY];
 }
 
 /**
Index: linux-2.6.30-rc3-mmotm-090428-1631/init/main.c
===================================================================
--- linux-2.6.30-rc3-mmotm-090428-1631.orig/init/main.c	2009-05-03 20:46:04.000000000 -0400
+++ linux-2.6.30-rc3-mmotm-090428-1631/init/main.c	2009-05-03 20:54:03.000000000 -0400
@@ -849,9 +849,9 @@ static int __init kernel_init(void * unu
 	lock_kernel();
 
 	/*
-	 * init can allocate pages on any node
+	 * init can allocate pages on any node with memory
 	 */
-	set_mems_allowed(node_possible_map);
+	set_mems_allowed(node_states[N_HIGH_MEMORY]);
 	/*
 	 * init can run on any cpu.
 	 */



WARNING: multiple messages have this Message-ID (diff)
From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm <linux-mm@kvack.org>,
	linux-numa <linux-numa@vger.kernel.org>,
	miaox@cn.fujitsu.com, Mel Gorman <mel@csn.ul.ie>,
	Doug Chapman <doug.chapman@hp.com>,
	Eric Whitney <eric.whitney@hp.com>,
	Bjorn Helgaas <bjorn.helgaas@hp.com>
Subject: [PATCH] Limit initial tasks' and top level cpuset's mems_allowed to nodes with memory
Date: Sun, 03 May 2009 23:06:04 -0400	[thread overview]
Message-ID: <1241406364.9211.18.camel@lts-notebook> (raw)


Against:  2.6.20-rc3-mmotm-090428-1631

Since cpusetmm-update-tasks-mems_allowed-in-time.patch removed the call outs
to cpuset_update_task_memory_state(), tasks in the top cpuset don't get their
mems_allowed updated to just nodes with memory.  cpuset_init()initializes
the top cpuset's mems_allowed with nodes_setall() and 
cpuset_init_current_mems_allowed() and kernel_init() initialize the kernel
initialization tasks' mems_allowed to all possible nodes.  Tasks in the top
cpuset that inherit the init task's mems_allowed without modification will
have all possible nodes set.  This can be seen by examining the Mems_allowed
field in /proc/<pid>/status in such a task.

"numactl --interleave=all" also initializes the interleave node mask to all
ones, depending on the masking with mems_allowed to eliminate non-existent
nodes and nodes without memory.  As this was not happening, the interleave
policy was attempting to dereference non-existent nodes.

This patch modifies the nodes_setall() calls in two cpuset init functions and
the initialization of task #1's mems_allowed to use node_states[N_HIGH_MEMORY]. 
This mask has been initialized to contain only existing nodes with memory by
the time the respective init functions are called.

This fixes the bogus pointer deref [Nat Consumption fault on ia64] reported
in:

	[BUG] 2.6.30-rc3-mmotm-090428-1814 -- bogus pointer deref

[The time--1814--was incorrect in that subject line, but the date was correct.]

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>

 init/main.c     |    4 ++--
 kernel/cpuset.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.30-rc3-mmotm-090428-1631/kernel/cpuset.c
===================================================================
--- linux-2.6.30-rc3-mmotm-090428-1631.orig/kernel/cpuset.c	2009-05-03 18:26:24.000000000 -0400
+++ linux-2.6.30-rc3-mmotm-090428-1631/kernel/cpuset.c	2009-05-03 20:46:04.000000000 -0400
@@ -1846,7 +1846,7 @@ int __init cpuset_init(void)
 		BUG();
 
 	cpumask_setall(top_cpuset.cpus_allowed);
-	nodes_setall(top_cpuset.mems_allowed);
+	top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
 
 	fmeter_init(&top_cpuset.fmeter);
 	set_bit(CS_SCHED_LOAD_BALANCE, &top_cpuset.flags);
@@ -2118,7 +2118,7 @@ void cpuset_cpus_allowed_locked(struct t
 
 void cpuset_init_current_mems_allowed(void)
 {
-	nodes_setall(current->mems_allowed);
+	current->mems_allowed = node_states[N_HIGH_MEMORY];
 }
 
 /**
Index: linux-2.6.30-rc3-mmotm-090428-1631/init/main.c
===================================================================
--- linux-2.6.30-rc3-mmotm-090428-1631.orig/init/main.c	2009-05-03 20:46:04.000000000 -0400
+++ linux-2.6.30-rc3-mmotm-090428-1631/init/main.c	2009-05-03 20:54:03.000000000 -0400
@@ -849,9 +849,9 @@ static int __init kernel_init(void * unu
 	lock_kernel();
 
 	/*
-	 * init can allocate pages on any node
+	 * init can allocate pages on any node with memory
 	 */
-	set_mems_allowed(node_possible_map);
+	set_mems_allowed(node_states[N_HIGH_MEMORY]);
 	/*
 	 * init can run on any cpu.
 	 */


--
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-05-04  3:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04  3:06 Lee Schermerhorn [this message]
2009-05-04  3:06 ` [PATCH] Limit initial tasks' and top level cpuset's mems_allowed to nodes with memory Lee Schermerhorn
2009-05-04 10:02 ` Miao Xie
2009-05-04 15:17   ` Lee Schermerhorn

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=1241406364.9211.18.camel@lts-notebook \
    --to=lee.schermerhorn@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=bjorn.helgaas@hp.com \
    --cc=doug.chapman@hp.com \
    --cc=eric.whitney@hp.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-numa@vger.kernel.org \
    --cc=lts@ldl.fc.hp.com \
    --cc=mel@csn.ul.ie \
    --cc=miaox@cn.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 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.