Re: [RFC] patch [1/1] x86_64 numa aware sparsemem add_memory functinality

Dave Hansen
2006-06-23T17:14:00Z

> int add_memory(u64 start, u64 size)
> {
> - struct pglist_data *pgdat = NODE_DATA(0);
> + struct pglist_data *pgdat = NODE_DATA(new_memory_to_node(start,start+size));
> struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;

How about just having new_memory_to_node() take the range and return the
pgdat? Should make that line a bit shorter.

> -#ifndef RESERVE_HOTADD
> +#if !defined(RESERVE_HOTADD) && !defined(CONFIG_MEMORY_HOTPLUG)
> #define hotadd_percent 0 /* Ignore all settings */
> #endif
> static u8 pxm2node[256] = { [0 ... 255] = 0xff };
> @@ -219,9 +219,9 @@
> allocated += mem;
> return 1;
> }
> -
> +#endif
> /*

Could this use another Kconfig option which gives a name to this
condition?

> +#ifdef RESERVE_HOTADD
> if (!hotadd_enough_memory(&nodes_add[node])) {
> printk(KERN_ERR "SRAT: Hotplug area too large\n");
> return -1;
> }
> -
> +#endif

This #ifdef is probably better handled by an #ifdef in the header for
hotadd_enough_memory().

-- Dave