Re: [PATCH: 001/012] Memory hotplug for new nodes v.2. (pgdatallocation)

From: Dave Hansen
Date: Fri Feb 17 2006 - 10:38:29 EST


On Fri, 2006-02-17 at 22:28 +0900, Yasunori Goto wrote:
>
> +extern int kswapd(void *);

In a header, please.

> +int new_pgdat_init(int nid, unsigned long start_pfn, unsigned long
> nr_pages)
> +{
> + unsigned long zones_size[MAX_NR_ZONES] = {0};
> + unsigned long zholes_size[MAX_NR_ZONES] = {0};
> + unsigned long pernode_size = arch_pernode_size(nid);
> + pg_data_t *pgdat;
> + struct task_struct *p;
> +
> + pgdat = kmalloc(pernode_size, GFP_KERNEL);
> + if (!pgdat){
> + printk(KERN_ERR "%s node_data allocation failed\n",
> + __FUNCTION__);
> + return -ENODEV;
> + }
> +
> + memset(pgdat, 0, pernode_size);

kzalloc() instead of explicit kmalloc/memset, please.

I'm a teensy bit concerned that this doesn't share enough code with the
boot-time initialization. For instance, the kthread_create() seems to
be a pretty darn generic piece. I'd feel a lot more at ease if this
patch did something with _existing_ code instead of just adding.

Also, can the regular boot code use your set_node_data_array() function?
Can you take out the "_array" part of the name?

-- Dave

-
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/