Re: [PATCH] mm/hotplug: Only respect mem= parameter during boot stage

Michal Hocko
2019-12-10T11:33:46Z

On Tue 10-12-19 18:43:03, Baoquan He wrote:
> On 12/10/19 at 11:28am, Michal Hocko wrote:
> > On Tue 10-12-19 15:24:53, Baoquan He wrote:
[...]
> > > But after system bootup, we should be able to hot add/remove any memory
> > > board. This should not be restricted by a boot-time kernel parameter
> > > 'mme='. This is what I am trying to fix.
> >
> > This is a simple statement without any actual explanation on why. Why is
> > hotplug memory special? What is the usecase? Who would want to use mem
> > parameter and later expect a memory above the restrected area to be
> > hotplugable?
>
> The why is 'mem=' is used to restrict the amount of system ram during
> boot. We have two ways to add system memory, one is installing DIMMs
> before boot, the other is hot adding memory after boot. Without David's
> use case, we may need redefine 'mem=' and change its documentation in
> kernel-parameters.txt, if we don't want to fix it like this. Otherwise,
> 'mem=' will limit the system's upper system ram always, that is not
> expected.

I really do not see why. It seems a pretty consistent behavior to me.
Because it essentially cut any memory above the given size. If a new
hotplugable memory fits into that cap then it just shows up. Quite
contrary I would consider it unexpected that a memory higher than the
given mem=XYZ is really there. But I do recognize a real usecase
mentioned elsewhere which beats the consistency argument here because
all setups where such a restriction would be really important are
debugging/workaround AFAICS.
--
Michal Hocko
SUSE Labs