[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9738c049-a6a2-19f7-f9be-e7ae98c2c66b@redhat.com>
Date: Wed, 16 Feb 2022 14:46:56 +0100
From: David Hildenbrand <david@...hat.com>
To: osalvador <osalvador@...e.de>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michal Hocko <mhocko@...e.com>,
Rafael Parra <rparrazo@...hat.com>
Subject: Re: [PATCH v2 2/2] drivers/base/memory: determine and store zone for
single-zone memory blocks
> Hi David
>
> Reviewed-by: Oscar Salvador <osalvador@...e.de>
>
> 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
Powered by blists - more mailing lists