From: Alexandre Ghiti <alex@ghiti.fr>
To: Johannes Weiner <hannes@cmpxchg.org>,
Yosry Ahmed <yosry@kernel.org>, Nhat Pham <nphamcs@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>
Cc: Kairui Song <ryncsn@gmail.com>,
Chengming Zhou <chengming.zhou@linux.dev>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jan Kara <jack@suse.cz>, Kemeng Shi <shikemeng@huaweicloud.com>,
Baoquan He <baoquan.he@linux.dev>, Barry Song <baohua@kernel.org>,
Youngjun Park <youngjun.park@lge.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Michal Hocko <mhocko@kernel.org>,
Axel Rasmussen <axelrasmussen@google.com>,
Qi Zheng <qi.zheng@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Wei Xu <weixugc@google.com>, Yuanchu Xie <yuanchu@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, Alexandre Ghiti <alex@ghiti.fr>
Subject: [PATCH v3 3/3] mm: zswap: drop cold writeback folios via swap dropbehind
Date: Tue, 18 Aug 2026 18:32:00 +0200 [thread overview]
Message-ID: <20260818163221.589352-4-alex@ghiti.fr> (raw)
In-Reply-To: <20260818163221.589352-1-alex@ghiti.fr>
zswap writeback decompresses an entry into a fresh swap cache folio and
writes it back. The folio is cold by construction, yet it is left on the
LRU for reclaim to find and free later, wasting a reclaim scan and keeping
cold memory resident longer than necessary.
Allocate the folio off the LRU and mark it PG_dropbehind so the swap
dropbehind path frees it from the swap cache once writeback completes.
Suggested-by: Johannes Weiner <hannes@cmpxchg.org>
Suggested-by: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
---
mm/zswap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index 8163e6c5f76c..a35671e837f8 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1013,7 +1013,6 @@ static int zswap_writeback_entry(struct zswap_entry *entry,
*/
if (IS_ERR(folio))
return PTR_ERR(folio);
- folio_add_lru(folio);
/*
* folio is locked, and the swapcache is now secured against
@@ -1046,8 +1045,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry,
/* folio is up to date */
folio_mark_uptodate(folio);
- /* move it to the tail of the inactive list after end_writeback */
- folio_set_reclaim(folio);
+ folio_set_dropbehind(folio);
/* start writeback */
__swap_writepage(folio, NULL);
--
2.53.0-Meta
next prev parent reply other threads:[~2026-08-18 16:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 16:31 [PATCH v3 0/3] mm: zswap: free cold writeback folios promptly Alexandre Ghiti
2026-08-18 16:31 ` [PATCH v3 1/3] mm: swap: move LRU insertion out of the swap cache allocator Alexandre Ghiti
2026-08-18 16:31 ` [PATCH v3 2/3] mm: swap: drop dropbehind swap cache folios on writeback completion Alexandre Ghiti
2026-08-20 11:36 ` Barry Song
2026-08-20 15:38 ` Matthew Wilcox
2026-08-21 5:00 ` Barry Song
2026-08-21 9:46 ` Alexandre Ghiti
2026-08-21 9:45 ` Alexandre Ghiti
2026-08-21 8:34 ` Kunwu Chan
2026-08-21 9:53 ` Alexandre Ghiti
2026-08-21 14:01 ` KunWu Chan
2026-08-24 9:30 ` Alexandre Ghiti
2026-08-24 16:39 ` KunWu Chan
2026-08-18 16:32 ` Alexandre Ghiti [this message]
2026-08-19 13:16 ` [PATCH v3 3/3] mm: zswap: drop cold writeback folios via swap dropbehind Alexandre Ghiti
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=20260818163221.589352-4-alex@ghiti.fr \
--to=alex@ghiti.fr \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=brauner@kernel.org \
--cc=chengming.zhou@linux.dev \
--cc=chrisl@kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=kasong@tencent.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@kernel.org \
--cc=nphamcs@gmail.com \
--cc=qi.zheng@linux.dev \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.com \
--cc=viro@zeniv.linux.org.uk \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=yosry@kernel.org \
--cc=youngjun.park@lge.com \
--cc=yuanchu@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