lkml.org 
[lkml]   [2023]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm: zswap: fix the lack of page lru flag in zswap_writeback_entry
Date
The zswap_writeback_entry() will add a page to the swap cache, decompress
the entry data into the page, and issue a bio write to write the page back
to the swap device. Move the page to the tail of lru list through
SetPageReclaim(page) and folio_rotate_reclaimable().

Currently, about half of the pages will fail to move to the tail of lru
list because there is no LRU flag in page which is not in the LRU list but
the cpu_fbatches. So fix it.

Signed-off-by: Zhongkun He <hezhongkun.hzk@bytedance.com>
---
mm/zswap.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/mm/zswap.c b/mm/zswap.c
index 083c693602b8..b9b94cbd403c 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1139,6 +1139,11 @@ static int zswap_writeback_entry(struct zswap_entry *entry,
/* move it to the tail of the inactive list after end_writeback */
SetPageReclaim(page);

+ if (!PageLRU(page)) {
+ /* drain lru cache to help folio_rotate_reclaimable() */
+ lru_add_drain();
+ }
+
/* start writeback */
__swap_writepage(page, &wbc);
put_page(page);
--
2.25.1
\
 
 \ /
  Last update: 2023-10-24 16:28    [W:0.324 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site