Re: [PATCH v4 1/1] mm: vmscan: Reduce throttling due to a failure to make progress

From: Mel Gorman
Date: Thu Dec 09 2021 - 04:53:25 EST


On Wed, Dec 08, 2021 at 10:20:47PM -0800, Hugh Dickins wrote:
> On Thu, 2 Dec 2021, Mel Gorman wrote:
> ...
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> ...
> > @@ -3478,14 +3520,18 @@ static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
> > /* need some check for avoid more shrink_zone() */
> > }
> >
> > + if (!first_pgdat)
> > + first_pgdat = zone->zone_pgdat;
> > +
> > /* See comment about same check for global reclaim above */
> > if (zone->zone_pgdat == last_pgdat)
> > continue;
> > last_pgdat = zone->zone_pgdat;
> > shrink_node(zone->zone_pgdat, sc);
> > - consider_reclaim_throttle(zone->zone_pgdat, sc);
> > }
> >
> > + consider_reclaim_throttle(first_pgdat, sc);
>
> My tmpfs swapping load (tweaked to use huge pages more heavily than
> in real life) is far from being a realistic load: but it was notably
> slowed down by your throttling mods in 5.16-rc, and this patch makes
> it well again - thanks.
>
> But: it very quickly hit NULL pointer until I changed that last line to
>
> if (first_pgdat)
> consider_reclaim_throttle(first_pgdat, sc);
>
> I've given no thought as to whether that is the correct fix,
> or if first_pgdat should be set earlier in the loop above.
>

It's the right fix, first_pgdat may be NULL if compaction can run for
each zone in the zonelist which could be the case for a tmpfs swapping
load that is huge page intensive.

Thanks Hugh.

--
Mel Gorman
SUSE Labs