linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Jan Kara <jack@suse.cz>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Lorenzo Stoakes <ljs@kernel.org>, Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH RFC] fs: drop_caches: introduce per-node drop_caches interface
Date: Thu, 9 Apr 2026 20:50:33 +0800	[thread overview]
Message-ID: <95bc0034-a72b-449c-9be4-b691fd03dc1e@huawei.com> (raw)
In-Reply-To: <adeFBKzNq9rNzbHk@tiehlicka>



On 4/9/2026 6:52 PM, Michal Hocko wrote:
> On Thu 09-04-26 16:54:48, Kefeng Wang wrote:
>>
>>
>> On 4/9/2026 4:22 PM, Michal Hocko wrote:
>>> On Thu 09-04-26 16:08:37, Kefeng Wang wrote:
>>> [...]
>>>> To use the reclaim interface, there are two differences,
>>>>
>>>> 1) we need to input the reclaim numbers and swappiness, this is not a big
>>>> problem
>>>> 2) for reclaim, it supports swappiness=max to only reclaim anonymous pages,
>>>> but cannot only reclaim file pages,
>>>
>>> Why is 2) a real constrain?
>>
>> This should not be a restriction, but a strategy. Our product wants to
>> migrate anonymous pages to the local instead of swapping them out. However,
>> the current per-node-reclaim interface does not support reclaiming only file
>> pages.
> 
> Yes, I do understand that you want to keep your hot anonymous pages
> resident on some node. Those shouldn't be reclaimed by the user space
> triggered reclaim anyway, right? Migration will then happen during the
> memory offlining.

Yes, that we need.
> 
> This will certainly require some fine tuning but I do not see any reason
> this should be completely impossible. Certainly a more robust way (from
> API POV) than the suggested drop_caches. I am also not convinced we need
> page-cache-only reclaim for the existing reclaim interface. I believe it
> makes more sense to look at the reclaim from hotness POV rather than
> anon vs. file.

It is already support only reclaim file pages when swappiness = 0 for
memcg.reclaim, but not for per-node-reclaim, so we can just make a few
small changes to enable it(no tested)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 84eba9ab5d25..46254ae9b8df 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2515,7 +2515,7 @@ static void get_scan_count(struct lruvec *lruvec, 
struct scan_control *sc,
          * using the memory controller's swap limit feature would be
          * too expensive.
          */
-       if (cgroup_reclaim(sc) && !swappiness) {
+       if ((cgroup_reclaim(sc) || sc->proactive) && !swappiness) {
                 scan_balance = SCAN_FILE;
                 goto out;
         }

or

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 84eba9ab5d25..e2998b61f78b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2515,7 +2515,7 @@ static void get_scan_count(struct lruvec *lruvec, 
struct scan_control *sc,
          * using the memory controller's swap limit feature would be
          * too expensive.
          */
-       if (cgroup_reclaim(sc) && !swappiness) {
+       if (sc->proactive && !swappiness) {
                 scan_balance = SCAN_FILE;
                 goto out;
         }





  reply	other threads:[~2026-04-09 12:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09  6:35 Kefeng Wang
2026-04-09  7:06 ` Michal Hocko
2026-04-09  7:19   ` Lorenzo Stoakes
2026-04-09  8:21     ` Kefeng Wang
2026-04-09  8:27       ` Lorenzo Stoakes
2026-04-09  8:08   ` Kefeng Wang
2026-04-09  8:22     ` Michal Hocko
2026-04-09  8:54       ` Kefeng Wang
2026-04-09 10:52         ` Michal Hocko
2026-04-09 12:50           ` Kefeng Wang [this message]
2026-04-09 13:00             ` Kefeng Wang
2026-04-09 13:01             ` Michal Hocko
2026-04-09 13:45               ` Kefeng Wang
2026-04-09  8:30     ` Lorenzo Stoakes
2026-04-09 15:16     ` Andrew Morton
2026-04-09 19:41       ` Michal Hocko

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=95bc0034-a72b-449c-9be4-b691fd03dc1e@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=david@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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