Re: 2.6.24-rc3-mm2 (bugfix for memory cgroup per-zone-structallocation.)

From: Lee Schermerhorn
Date: Thu Nov 29 2007 - 16:25:36 EST


On Thu, 2007-11-29 at 14:24 +0900, KAMEZAWA Hiroyuki wrote:
> On Thu, 29 Nov 2007 12:23:29 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> > I noticed CONFIG_NUMA + CONFIG_CGROUP_MEM_CONT + CONFIG_SLUB cannot boot because of my patch.
> > (SLAB is ok.)
> > I'll post workaround soon.
> >
> ==
> This is a fix. tested on my ia64/NUMA box both on SLAB/SLUB.
> This patch fixes kmalloc_node() is called against node-without-memory.
>
> It's better to add memory hotplug callback for supporing possible nodes
> (memory hotplug) but here just uses kmalloc().
>
> Should be revisited later.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
>
> mm/memcontrol.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> Index: linux-2.6.24-rc3-mm2/mm/memcontrol.c
> ===================================================================
> --- linux-2.6.24-rc3-mm2.orig/mm/memcontrol.c
> +++ linux-2.6.24-rc3-mm2/mm/memcontrol.c
> @@ -1117,8 +1117,18 @@ static int alloc_mem_cgroup_per_zone_inf
> struct mem_cgroup_per_node *pn;
> struct mem_cgroup_per_zone *mz;
> int zone;
> -
> - pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node);
> + /*
> + * This routine is called against possible nodes.
> + * But it's BUG to call kmalloc() against offline node.
> + *
> + * TODO: this routine can waste much memory for nodes which will
> + * never be onlined. It's better to use memory hotplug callback
> + * function.
> + */
> + if (node_state(node, N_HIGH_MEMORY))
> + pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node);
> + else
> + pn = kmalloc(sizeof(*pn), GFP_KERNEL);
> if (!pn)
> return 1;
>
>

This worked for me. Can boot 24-rc3-mm2 [if I turn off async scsi scan,
that is--not related to mem controller].

Just FYI, on my ia64 platform, with NODES_SHIFT == 8 [RHEL & SLES ship
with 10, I believe], the size of the mem_cgroup structure is ~10KB.

Lee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/