提交 41e3355d 编写于 作者: K KAMEZAWA Hiroyuki 提交者: Linus Torvalds

memcg: fix node_state handling

This should be N_NORMAL_MEMORY.

N_NORMAL_MEMORY is "true" if a node has memory for the kernel.  N_HIGH_MEMORY
is "true" if a node has memory for HIGHMEM.  (If CONFIG_HIGHMEM=n, always
"true")

This check is used for testing whether we can use kmalloc_node() on a node.
Then, if there is a node which only contains HIGHMEM, the system will call
kmalloc_node() which doesn't contain memory for the kernel.  If it happens
under SLUB, the kernel will panic.  I think this only happens on x86_32-numa.
Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 bb070e43
...@@ -978,7 +978,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node) ...@@ -978,7 +978,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
{ {
struct mem_cgroup_per_node *pn; struct mem_cgroup_per_node *pn;
struct mem_cgroup_per_zone *mz; struct mem_cgroup_per_zone *mz;
int zone; int zone, tmp = node;
/* /*
* This routine is called against possible nodes. * This routine is called against possible nodes.
* But it's BUG to call kmalloc() against offline node. * But it's BUG to call kmalloc() against offline node.
...@@ -987,10 +987,9 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node) ...@@ -987,10 +987,9 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
* never be onlined. It's better to use memory hotplug callback * never be onlined. It's better to use memory hotplug callback
* function. * function.
*/ */
if (node_state(node, N_HIGH_MEMORY)) if (!node_state(node, N_NORMAL_MEMORY))
pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node); tmp = -1;
else pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, tmp);
pn = kmalloc(sizeof(*pn), GFP_KERNEL);
if (!pn) if (!pn)
return 1; return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册