Re: [PATCH v3 3/3] mm/vmscan: don't demote if there is not enough free memory in the lower memory tier
From: Michal Hocko
Date: Wed Jan 28 2026 - 16:14:21 EST
On Wed 28-01-26 09:21:45, Gregory Price wrote:
> On Wed, Jan 28, 2026 at 10:56:44AM +0100, Michal Hocko wrote:
> > > .gfp_mask = (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) |
> > > __GFP_NOMEMALLOC | GFP_NOWAIT,
> > > };
> >
> > This will trigger kswapd so there will be background reclaim demoting
> > from those lower tiers.
> >
>
> given the node is full kswapd will be running, but the above line masks
> ~__GFP_RECLAIM so it's not supposed to trigger either reclaim path.
Yeah, my bad, I haven't looked carefully enough.
> > > Any chance you are using hugetlb on this system? This looks like a
> > > clear bug, but it may not be what you're experiencing.
> >
> > Hugetlb pages are not sitting on LRU lists so they are not participating
> > in the demotion.
> >
>
> I noted in the v4 thread (responded there too) this was the case.
> https://lore.kernel.org/linux-mm/aXksUiwYGwad5JvC@gourry-fedora-PF4VCD3F/
>
> But since then we found another path through this code that adds
> reclaim back on as well - and i wouldn't be surprised to find more.
>
> the bigger issue is that this fix can cause inversions in transient
> pressure situations - and in fact the current code will cause inversions
> instead of waiting for reclaim to clear out lower nodes.
>
> The reality is this code probably needs a proper look and detangling.
Agreed!
> This has been on my back-burner for a while - i've wanted to sink the
> actual demotion code into memory-tiers.c and provide something like:
>
> ... mt_demote_folios(src_nid, folio_list)
> {
> /* apply some demotion policy here */
> }
>
> ~Gregory
--
Michal Hocko
SUSE Labs