linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <muchun.song@linux.dev>
To: Zhongkun He <hezhongkun.hzk@bytedance.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@suse.com,
	yosry.ahmed@linux.dev, yuzhao@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4 1/4] mm: add swappiness=max arg to memory.reclaim for only anon reclaim
Date: Mon, 21 Apr 2025 17:34:50 +0800	[thread overview]
Message-ID: <972CD38C-9084-4CC0-8AD7-127745CACCDF@linux.dev> (raw)
In-Reply-To: <519e12b9b1f8c31a01e228c8b4b91a2419684f77.1745225696.git.hezhongkun.hzk@bytedance.com>



> On Apr 21, 2025, at 17:13, Zhongkun He <hezhongkun.hzk@bytedance.com> wrote:
> 
> With this patch 'commit <68cd9050d871> ("mm: add swappiness= arg to
> memory.reclaim")', we can submit an additional swappiness=<val> argument
> to memory.reclaim. It is very useful because we can dynamically adjust
> the reclamation ratio based on the anonymous folios and file folios of
> each cgroup. For example,when swappiness is set to 0, we only reclaim
> from file folios.
> 
> However,we have also encountered a new issue: when swappiness is set to
> the MAX_SWAPPINESS, it may still only reclaim file folios.
> 
> So, we hope to add a new arg 'swappiness=max' in memory.reclaim where
> proactive memory reclaim only reclaims from anonymous folios when
> swappiness is set to max. The swappiness semantics from a user
> perspective remain unchanged.
> 
> For example, something like this:
> 
> echo "2M swappiness=max" > /sys/fs/cgroup/memory.reclaim

We already have this kind of style (mixing numbers and strings) within
io.max under cgroup v2. As a result, I'm okay with this change. 

> 
> will perform reclaim on the rootcg with a swappiness setting of 'max' (a
> new mode) regardless of the file folios. Users have a more comprehensive
> view of the application's memory distribution because there are many
> metrics available. For example, if we find that a certain cgroup has a
> large number of inactive anon folios, we can reclaim only those and skip
> file folios, because with the zram/zswap, the IO tradeoff that
> cache_trim_mode or other file first logic is making doesn't hold -
> file refaults will cause IO, whereas anon decompression will not.
> 
> With this patch, the swappiness argument of memory.reclaim has a new
> mode 'max', means reclaiming just from anonymous folios both in traditional
> LRU and MGLRU.
> 
> Here is the previous discussion:
> https://lore.kernel.org/all/20250314033350.1156370-1-hezhongkun.hzk@bytedance.com/
> https://lore.kernel.org/all/20250312094337.2296278-1-hezhongkun.hzk@bytedance.com/
> https://lore.kernel.org/all/20250318135330.3358345-1-hezhongkun.hzk@bytedance.com/
> 
> Suggested-by: Yosry Ahmed <yosry.ahmed@linux.dev>
> Signed-off-by: Zhongkun He <hezhongkun.hzk@bytedance.com>

Acked-by: Muchun Song <muchun.song@linux.dev>

Thanks.

  reply	other threads:[~2025-04-21  9:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21  9:13 [PATCH V4 0/4] add max arg to swappiness in memory.reclaim and lru_gen Zhongkun He
2025-04-21  9:13 ` [PATCH V4 1/4] mm: add swappiness=max arg to memory.reclaim for only anon reclaim Zhongkun He
2025-04-21  9:34   ` Muchun Song [this message]
2025-04-22  6:16     ` [External] " Zhongkun He
2025-04-21  9:13 ` [PATCH V4 2/4] mm: vmscan: add more comments about cache_trim_mode Zhongkun He
2025-04-21  9:13 ` [PATCH V4 3/4] mm: add max swappiness arg to lru_gen for anonymous memory only Zhongkun He
2025-04-21  9:35   ` Muchun Song
2025-04-22  6:18     ` [External] " Zhongkun He
2025-05-07  7:10   ` [PATCH update] " Zhongkun He
2025-04-21  9:13 ` [PATCH V4 4/4] mm: using SWAPPINESS_ANON_ONLY in MGLRU Zhongkun He

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=972CD38C-9084-4CC0-8AD7-127745CACCDF@linux.dev \
    --to=muchun.song@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hezhongkun.hzk@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=yosry.ahmed@linux.dev \
    --cc=yuzhao@google.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