Re: [PATCH v2 2/2] drivers/base/memory: determine and store zone for single-zone memory blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi David
> 
> Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>
> 
> One minor thing below: 
> 
>> @@ -663,6 +743,17 @@ static int init_memory_block(unsigned long block_id, unsigned long state,
>>  	mem->nr_vmemmap_pages = nr_vmemmap_pages;
>>  	INIT_LIST_HEAD(&mem->group_next);
>>  
>> +#ifndef CONFIG_NUMA
>> +	if (state == MEM_ONLINE)
>> +		/*
>> +		 * MEM_ONLINE at this point implies early memory. With NUMA,
>> +		 * we'll determine the zone when setting the node id via
>> +		 * memory_block_add_nid(). Memory hotplug updated the zone
>> +		 * manually when memory onlining/offlining succeeds.
>> +		 */
>> +		mem->zone = early_node_zone_for_memory_block(mem, NUMA_NO_NODE);
> 
> I took me a couple of minutes to figure out that MEM_ONLINE implies
> early memory at this point because 1) of course early memory must be
> online and 2) the only caller that passes MEM_ONLINE to
> init_memory_block() is add_memory_block(), which only gets called at
> boot time. (btw, add_memory_block() really should use __init, right?)
> 
> I guess what I am saying here is: I really like the comment, but I am not sure
> whether other people with a drifting brain like mine will also wonder about
> that.

Thanks for the review!

I originally planned on passing "enum meminit_context context" here, but
it just uglifies the function without any real added value. MEM_ONLINE
is fully expressive.

In general:
a) Boot memory always starts out online.
b) Hotplugged memory always starts out offline.


And yes, add_memory_block() chould __init, that would also make it
clearer out of which context init_memory_block() is called with
MEM_ONLINE. I can send an addon patch for that!

-- 
Thanks,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux