This is a note to let you know that I've just added the patch titled mm/zswap: invalidate duplicate entry when !zswap_enabled to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-zswap-invalidate-duplicate-entry-when-zswap_enabled.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 678e54d4bb9a4822f8ae99690ac131c5d490cdb1 Mon Sep 17 00:00:00 2001 From: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx> Date: Thu, 8 Feb 2024 02:32:54 +0000 Subject: mm/zswap: invalidate duplicate entry when !zswap_enabled From: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx> commit 678e54d4bb9a4822f8ae99690ac131c5d490cdb1 upstream. We have to invalidate any duplicate entry even when !zswap_enabled since zswap can be disabled anytime. If the folio store success before, then got dirtied again but zswap disabled, we won't invalidate the old duplicate entry in the zswap_store(). So later lru writeback may overwrite the new data in swapfile. Link: https://lkml.kernel.org/r/20240208023254.3873823-1-chengming.zhou@xxxxxxxxx Fixes: 42c06a0e8ebe ("mm: kill frontswap") Signed-off-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Nhat Pham <nphamcs@xxxxxxxxx> Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- mm/zswap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1215,7 +1215,7 @@ bool zswap_store(struct folio *folio) if (folio_test_large(folio)) return false; - if (!zswap_enabled || !tree) + if (!tree) return false; /* @@ -1231,6 +1231,9 @@ bool zswap_store(struct folio *folio) } spin_unlock(&tree->lock); + if (!zswap_enabled) + return false; + /* * XXX: zswap reclaim does not work with cgroups yet. Without a * cgroup-aware entry LRU, we will push out entries system-wide based on Patches currently in stable-queue which might be from zhouchengming@xxxxxxxxxxxxx are queue-6.6/mm-zswap-fix-missing-folio-cleanup-in-writeback-race-path.patch queue-6.6/mm-zswap-invalidate-duplicate-entry-when-zswap_enabled.patch