linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: osalvador <osalvador@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michal Hocko <mhocko@suse.com>,
	Rafael Parra <rparrazo@redhat.com>
Subject: Re: [PATCH v2 2/2] drivers/base/memory: determine and store zone for single-zone memory blocks
Date: Wed, 16 Feb 2022 14:46:56 +0100	[thread overview]
Message-ID: <9738c049-a6a2-19f7-f9be-e7ae98c2c66b@redhat.com> (raw)
In-Reply-To: <YguFFRiNIktJhGnT@localhost.localdomain>

> Hi David
> 
> Reviewed-by: Oscar Salvador <osalvador@suse.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



  reply	other threads:[~2022-02-16 13:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 18:43 [PATCH v2 0/2] drivers/base/memory: determine and store zone for single-zone memory blocks David Hildenbrand
2022-02-10 18:43 ` [PATCH v2 1/2] drivers/base/node: rename link_mem_sections() to register_memory_block_under_node() David Hildenbrand
2022-02-10 18:43 ` [PATCH v2 2/2] drivers/base/memory: determine and store zone for single-zone memory blocks David Hildenbrand
2022-02-15 10:48   ` osalvador
2022-02-16 13:46     ` David Hildenbrand [this message]
2022-02-16 15:45       ` Oscar Salvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9738c049-a6a2-19f7-f9be-e7ae98c2c66b@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=rafael@kernel.org \
    --cc=rparrazo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).