linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zswap: initialize entry->pool on same filled entry
@ 2024-03-21 23:53 Chris Li
  2024-03-21 23:56 ` Yosry Ahmed
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Li @ 2024-03-21 23:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-mm, Yosry Ahmed, Nhat Pham, Johannes Weiner,
	Chengming Zhou, Chris Li

Current zswap will leave the entry->pool uninitialized if
the page is same  filled. The entry->pool pointer can
contain data written by previous usage.

Initialize entry->pool to zero for the same filled zswap entry.

Signed-off-by: Chris Li <chrisl@kernel.org>
---
Per Yosry's suggestion to split out this clean up
from the zxwap rb tree to xarray patch.

https://lore.kernel.org/all/ZemDuW25YxjqAjm-@google.com/
---
 mm/zswap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/zswap.c b/mm/zswap.c
index b31c977f53e9..f04a75a36236 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1527,6 +1527,7 @@ bool zswap_store(struct folio *folio)
 			kunmap_local(src);
 			entry->length = 0;
 			entry->value = value;
+			entry->pool = 0;
 			atomic_inc(&zswap_same_filled_pages);
 			goto insert_entry;
 		}

---
base-commit: a824831a082f1d8f9b51a4c0598e633d38555fcf
change-id: 20240315-zswap-fill-f65f44574760

Best regards,
-- 
Chris Li <chrisl@kernel.org>



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

end of thread, other threads:[~2024-03-22 18:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-21 23:53 [PATCH] zswap: initialize entry->pool on same filled entry Chris Li
2024-03-21 23:56 ` Yosry Ahmed
2024-03-22  0:41   ` Chris Li
2024-03-22  3:19   ` Johannes Weiner
2024-03-22 13:35     ` Chris Li
2024-03-22 17:11       ` Johannes Weiner
2024-03-22 17:57         ` Chris Li
2024-03-22 18:58         ` Yosry Ahmed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox