Re: [RFC 0/2] mm: add source selectors to memory.reclaim
From: Gregory Price
Date: Mon Oct 19 2026 - 12:43:15 EST
On Mon, Oct 19, 2026 at 10:13:59PM +0800, Li Zhe wrote:
> memory.reclaim is a useful proactive reclaim interface for memcgs, but
> tiered memory makes "reclaim N bytes from this memcg" underspecified for
> userspace controllers that manage memory placement across tiers. The
> kernel's reclaim policy is aging-based, and on tiered systems aging may
> demote folios before they are eventually evicted. Without a way to
> declare where reclaim pressure should start, userspace can only reclaim
> from the memcg as a whole and observe one aggregate progress value.
This is not a good argument for pushing the complexity of managing tiers
into userspace - it is an argument for fixing the reclaim interface to
handle demotion and eviction sanely - which presently we do not do.
My best examples:
1) the watermarks don't make sense for lower tiers that need to absorb
large amounts of demotions from upper tiers. It's likely lower
tiers need larger WMARK_PROMO to let low-tier kswapd run longer.
2) proactive and async reclaim current reclaim top-down, which results
in swapping directly from top-tiers because lower tiers don't have
space to absorb demotions. We should experiment with async /
proactive reclaim applying bottom-up (lowest tier first) so aging
the top-tiers demotes into lower tiers more successfully.
direct reclaim should stay top-down because we want the best page
with the least work to minimize stalls.
I have a strong suspicion if we made these change, then memcg.reclaim
would work more or less the way you'd want - and anything else can be
managed more directly with madvise/process_madvise.
I also have concerns with extending memory.reclaim this way permanently
locking in reclaim implementation details that prevent us from making
changes like this in the future.
~Gregory