Re: [v4 5/6] mm/memory_hotplug: don't read nid from struct page during hotplug

From: Ingo Molnar
Date: Fri Feb 16 2018 - 04:19:28 EST



* Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> wrote:

> During memory hotplugging the probe routine will leave struct pages
> uninitialized, the same as it is currently done during boot. Therefore, we
> do not want to access the inside of struct pages before
> __init_single_page() is called during onlining.
>
> Because during hotplug we know that pages in one memory block belong to
> the same numa node, we can skip the checking. We should keep checking for
> the boot case.
>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
> ---
> drivers/base/memory.c | 2 +-
> drivers/base/node.c | 22 +++++++++++++++-------
> include/linux/node.h | 4 ++--
> 3 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index deb3f029b451..a14fb0cd424a 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -731,7 +731,7 @@ int register_new_memory(int nid, struct mem_section *section)
> }
>
> if (mem->section_count == sections_per_block)
> - ret = register_mem_sect_under_node(mem, nid);
> + ret = register_mem_sect_under_node(mem, nid, false);
> out:

The namespace of all these memory range handling functions is horribly random,
and I think now it got worse: we add an assumption that register_new_memory() is
implicitly called as part of hotplugged memory (where things are pre-cleared) -
but nothing in its naming suggests so.

How about renaming it to hotplug_memory_register() or so?

With that change you can add:

Reviewed-by: Ingo Molnar <mingo@xxxxxxxxxx>

Thanks,

Ingo