From: "Gregory Price (Meta)" <gourry@gourry.net>
To: Li Zhe <lizhe.67@bytedance.com>
Cc: akpm@linux-foundation.org, david@kernel.org, gourry@gourry.net,
joshua.hahnjy@gmail.com, ljs@kernel.org, mhocko@suse.com,
muchun.song@linux.dev, rakie.kim@sk.com,
roman.gushchin@linux.dev, shakeel.butt@linux.dev,
weixugc@google.com, ying.huang@linux.alibaba.com,
ziy@nvidia.com, cgroups@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [RFC v2 1/1] mm: add source selector to memory.reclaim
Date: Fri, 13 Nov 2026 02:20:20 -0500 [thread overview]
Message-ID: <179455442014.482102.4069329165987986914.b4-reply@b4> (raw)
In-Reply-To: <20261102070440.16262-2-lizhe.67@bytedance.com>
On 2026-11-02 15:04 +0800, Li Zhe wrote:
> + Specifying a source value constrains where proactive reclaim applies
> + pressure. Currently only source=nodes:<nodelist> is supported. For
> + example::
> +
> + echo "1G source=nodes:0-1" > memory.reclaim
> +
> + This reclaims memory of the target cgroup resident on nodes 0-1.
you buried the fact that you want to allow source=zswap in your cover
letter. I was confused by nodes: was needed here until i re-read.
As Joshua mentioned, i don't think you need the separate cover letter,
and I agree this is far too long for the proposed change.
---
When I asked for testing, I wasn't concerned with the functionality,
I was asking what problem this actually solves. performance? fairness?
Shaping the distribution of memory is neat and clearly works, but why
does userspace want this?
The interface "lacking flexibility" is not a problem in and of itself.
I CAN see why you might want to proactively shape what data is swapped.
Let me give you an example:
---
The global node reclaim interfaces allow us to put pressure on distinct
nodes - which lets us shape which node is swapped from first.
Example: node0-1=DRAM, node2-3:CXL
echo 1G > node2/reclaim # swap from CXL
echo 1G > node3/reclaim # swap from CXL
echo 1G > node0/reclaim # demote to CXL
echo 1G > node1/reclaim # demote to CXL
But the memcg.reclaim interface only allows us to pressure the complete
set of cpuset.mems nodes for that memcg
cat cpuset.mems # 0-3
echo 1G > memory.reclaim # makes progress from any of 0-3
Presently, proactive reclaim iterates nodes in node or fallback order,
meaning it attempts to make progress from the fastest node possible
first - which attempts to demote by default. If the lower nodes are
full, this demotion will fail and we'll swap directly from the top tier,
which is (presumably) warmer than the bottom tiers.
Enable source-bound reclaim in the memory.reclaim interface so that user
space can have the same control over memcg memory tiers that global
proactive reclaim has.
echo 2G source=nodes:2-3 > memory.reclaim # [z]swap from CXL
echo 2G source=nodes:0-1 > memory.reclaim # demote to CXL
This lets user proactive reclaim to target the coldest memory first
rather than preferring to reclaim from node0 first and potentially
swap out memory warmer than what is present on a CXL tier.
---
With this, you might be able to demonstrate fewer refaults and less
DRAM (node0) memory consumed by zswap. These are clear benefits.
I would argue that memory.reclaim should operate this way anyway,
and that would could make proactive reclaim do this by default, but
I could see the policy bits in userland being useful as well
Performance may not be the only reason you want this, but you need to
help me understand what you're trying to accomplish.
--
~Gregory
next prev parent reply other threads:[~2026-11-13 7:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 7:04 [RFC v2 0/1] " Li Zhe
2026-11-02 7:04 ` [RFC v2 1/1] " Li Zhe
2026-11-13 7:20 ` Gregory Price (Meta) [this message]
2026-11-12 23:48 ` [RFC v2 0/1] " Joshua Hahn
2026-11-13 3:36 ` Li Zhe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179455442014.482102.4069329165987986914.b4-reply@b4 \
--to=gourry@gourry.net \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=david@kernel.org \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizhe.67@bytedance.com \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=rakie.kim@sk.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=weixugc@google.com \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®