Re: [-next] memory hotplug regression

From: Michal Hocko
Date: Wed May 31 2017 - 02:24:47 EST


On Tue 30-05-17 16:55:01, Heiko Carstens wrote:
> On Tue, May 30, 2017 at 04:32:47PM +0200, Michal Hocko wrote:
> > On Tue 30-05-17 14:37:24, Heiko Carstens wrote:
> > > On Tue, May 30, 2017 at 02:18:06PM +0200, Michal Hocko wrote:
> > > > > So ZONE_DMA ends within ZONE_NORMAL. This shouldn't be possible, unless
> > > > > this restriction is gone?
> > > >
> > > > The patch below should help.
> > >
> > > It does fix this specific problem, but introduces a new one:
> > >
> > > # echo online_movable > /sys/devices/system/memory/memory16/state
> > > # cat /sys/devices/system/memory/memory16/valid_zones
> > > Movable
> > > # echo offline > /sys/devices/system/memory/memory16/state
> > > # cat /sys/devices/system/memory/memory16/valid_zones
> > > <--- no output
> > >
> > > Memory block 16 is the only one I onlined and offlineto ZONE_MOVABLE.
> >
> > Could you test the this on top please?
> > ---
> > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> > index 792c098e0e5f..a26f9f8e6365 100644
> > --- a/mm/memory_hotplug.c
> > +++ b/mm/memory_hotplug.c
> > @@ -937,13 +937,18 @@ void __ref move_pfn_range_to_zone(struct zone *zone,
> > set_zone_contiguous(zone);
> > }
> >
> > +/*
> > + * Returns a default kernel memory zone for the given pfn range.
> > + * If no kernel zone covers this pfn range it will automatically go
> > + * to the ZONE_NORMAL.
> > + */
> > struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn,
> > unsigned long nr_pages)
> > {
> > struct pglist_data *pgdat = NODE_DATA(nid);
> > int zid;
> >
> > - for (zid = 0; zid < MAX_NR_ZONES; zid++) {
> > + for (zid = 0; zid <= ZONE_NORMAL; zid++) {
> > struct zone *zone = &pgdat->node_zones[zid];
> >
> > if (zone_intersects(zone, start_pfn, nr_pages))
>
> Still broken, but in different way(s):
>
> # cat /sys/devices/system/memory/memory16/valid_zones
> Normal Movable
> # echo online_movable > /sys/devices/system/memory/memory16/state
> # cat /sys/devices/system/memory/memory16/valid_zones
> Movable
> # cat /sys/devices/system/memory/memory18/valid_zones
> Movable
> # echo online > /sys/devices/system/memory/memory18/state
> # cat /sys/devices/system/memory/memory18/valid_zones
> Normal <--- should be Movable
> # cat /sys/devices/system/memory/memory17/valid_zones
> <--- no output

OK, so this is an independent problem and an unrelated one to the
patch I've posted. We need two patches actually. Damn, I hate
MMOP_ONLINE_KEEP. I will send 2 patches as a reply to this email.

--
Michal Hocko
SUSE Labs