[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACSyD1Ouy=iYY85V7rEHq5sU_VNUsninMkBow=RWbyOSJ6n4WQ@mail.gmail.com>
Date: Tue, 22 Apr 2025 14:16:23 +0800
From: Zhongkun He <hezhongkun.hzk@...edance.com>
To: Muchun Song <muchun.song@...ux.dev>
Cc: akpm@...ux-foundation.org, hannes@...xchg.org, mhocko@...e.com,
yosry.ahmed@...ux.dev, yuzhao@...gle.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [External] Re: [PATCH V4 1/4] mm: add swappiness=max arg to
memory.reclaim for only anon reclaim
On Mon, Apr 21, 2025 at 5:35 PM Muchun Song <muchun.song@...ux.dev> wrote:
>
>
>
> > On Apr 21, 2025, at 17:13, Zhongkun He <hezhongkun.hzk@...edance.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@...ux.dev>
> > Signed-off-by: Zhongkun He <hezhongkun.hzk@...edance.com>
>
> Acked-by: Muchun Song <muchun.song@...ux.dev>
Thank you for your time, Muchun.
>
> Thanks.
Powered by blists - more mailing lists