linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: zswap: fix the lack of page lru flag in  zswap_writeback_entry
@ 2023-10-24 14:27 Zhongkun He
  2023-12-29 19:44 ` Andrew Morton
  2023-12-30  2:09 ` Nhat Pham
  0 siblings, 2 replies; 29+ messages in thread
From: Zhongkun He @ 2023-10-24 14:27 UTC (permalink / raw)
  To: akpm
  Cc: hannes, yosryahmed, nphamcs, sjenning, ddstreet, vitaly.wool,
	linux-mm, linux-kernel, Zhongkun He

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



^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2024-01-17 19:29 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-24 14:27 [PATCH] mm: zswap: fix the lack of page lru flag in zswap_writeback_entry Zhongkun He
2023-12-29 19:44 ` Andrew Morton
2023-12-30  2:09 ` Nhat Pham
2024-01-02 11:39   ` [External] " Zhongkun He
2024-01-02 14:09     ` Zhongkun He
2024-01-02 23:27     ` Nhat Pham
2024-01-03 14:12       ` Zhongkun He
2024-01-04 19:42         ` Nhat Pham
2024-01-05 14:10           ` Zhongkun He
2024-01-07 18:53             ` Nhat Pham
2024-01-07 21:29             ` Nhat Pham
2024-01-07 21:59               ` Nhat Pham
2024-01-08 23:12                 ` Yosry Ahmed
2024-01-09  3:13                   ` Zhongkun He
2024-01-09 16:29                     ` Yosry Ahmed
2024-01-10  1:32                       ` Nhat Pham
2024-01-11  3:48                         ` Zhongkun He
2024-01-11 11:27                           ` Yosry Ahmed
2024-01-11 19:25                           ` Nhat Pham
2024-01-12  7:08                             ` Zhongkun He
2024-01-16 13:40                               ` Zhongkun He
2024-01-16 20:28                                 ` Yosry Ahmed
2024-01-17  9:52                                   ` Zhongkun He
2024-01-17 17:53                                     ` Yosry Ahmed
2024-01-17 19:29                                     ` Nhat Pham
2024-01-16 21:03                                 ` Matthew Wilcox
2024-01-17 10:41                                   ` Zhongkun He
2024-01-11  2:57                       ` Zhongkun He
2024-01-09  2:43                 ` Zhongkun He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).