Re: [PATCH 1/1] mm/memory_hotplug: Adds option to hot-add memory in ZONE_MOVABLE

From: Pavel Tatashin
Date: Thu Jul 18 2019 - 12:45:52 EST


On Thu, Jul 18, 2019 at 12:04 PM Leonardo Bras <leonardo@xxxxxxxxxxxxx> wrote:
>
> On Thu, 2019-07-18 at 08:19 -0400, Pavel Tatashin wrote:
> > On Wed, Jul 17, 2019 at 10:42 PM Leonardo Bras <leonardo@xxxxxxxxxxxxx> wrote:
> > > Adds an option on kernel config to make hot-added memory online in
> > > ZONE_MOVABLE by default.
> > >
> > > This would be great in systems with MEMORY_HOTPLUG_DEFAULT_ONLINE=y by
> > > allowing to choose which zone it will be auto-onlined
> >
> > This is a desired feature. From reading the code it looks to me that
> > auto-selection of online method type should be done in
> > memory_subsys_online().
> >
> > When it is called from device online, mem->online_type should be -1:
> >
> > if (mem->online_type < 0)
> > mem->online_type = MMOP_ONLINE_KEEP;
> >
> > Change it to:
> > if (mem->online_type < 0)
> > mem->online_type = MMOP_DEFAULT_ONLINE_TYPE;
> >
> > And in "linux/memory_hotplug.h"
> > #ifdef CONFIG_MEMORY_HOTPLUG_MOVABLE
> > #define MMOP_DEFAULT_ONLINE_TYPE MMOP_ONLINE_MOVABLE
> > #else
> > #define MMOP_DEFAULT_ONLINE_TYPE MMOP_ONLINE_KEEP
> > #endif
> >
> > Could be expanded to support MMOP_ONLINE_KERNEL as well.
> >
> > Pasha
>
> Thanks for the suggestions Pasha,
>
> I was made aware there is a kernel boot option "movable_node" that
> already creates the behavior I was trying to reproduce.

I agree with others, no need to duplicate this functionality in a
config, and Michal in a separate e-mail explained the reasons why we
have MEMORY_HOTPLUG_DEFAULT_ONLINE.

>
> I was thinking of changing my patch in order to add a config option
> that makes this behavior default (i.e. not need to pass it as a boot
> parameter.
>
> Do you think that it would still be a desired feature?
>
> Regards,
>
> Leonardo BrÃs