Skip to contentSkip to conversation

FAILED: patch "[PATCH] mm/zswap: invalidate duplicate entry when !zswap_enabled" failed to apply to 6.7-stable tree

PATCH In review [email protected] 2 participants 5 messages Feb 26, 2024 – Feb 27, 2024

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.7.y
git checkout FETCH_HEAD
git cherry-pick -x 678e54d4bb9a4822f8ae99690ac131c5d490cdb1
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024022622-agony-salvaging-5082@gregkh' --subject-prefix 'PATCH 6.7.y' HEAD^..

Possible dependencies:

678e54d4bb9a ("mm/zswap: invalidate duplicate entry when !zswap_enabled") a65b0e7607cc ("zswap: make shrinking memcg-aware")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 678e54d4bb9a4822f8ae99690ac131c5d490cdb1 Mon Sep 17 00:00:00 2001
From: Chengming Zhou <[email protected]>
Date: Thu, 8 Feb 2024 02:32:54 +0000
Subject: [PATCH] mm/zswap: invalidate duplicate entry when !zswap_enabled

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.

mm/zswap.c +5 -1
index 36903d938c15..db4625af65fb 100644
@@ -1518,7 +1518,7 @@ bool zswap_store(struct folio *folio)
 	if (folio_test_large(folio))
 		return false;
 
-	if (!zswap_enabled || !tree)
+	if (!tree)
 		return false;
 
 	/*
@@ -1533,6 +1533,10 @@ bool zswap_store(struct folio *folio)
 		zswap_invalidate_entry(tree, dupentry);
 	}
 	spin_unlock(&tree->lock);
+
+	if (!zswap_enabled)
+		return false;
+
 	objcg = get_obj_cgroup_from_folio(folio);
 	if (objcg && !obj_cgroup_may_zswap(objcg)) {
 		memcg = get_mem_cgroup_from_objcg(objcg);
#1 lore raw

PATCH 1/1 mm/zswap: invalidate duplicate entry when !zswap_enabled

From: Chengming Zhou <[email protected]>

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.

Fixes 42c06a0e8ebe ("mm: kill frontswap")
Cc Nhat Pham <[email protected]>
Cc Yosry Ahmed <[email protected]>
(cherry picked from commit 678e54d4bb9a4822f8ae99690ac131c5d490cdb1)
---
 mm/zswap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
mm/zswap.c +4 -1
index 74411dfdad92..19425d698e69 100644
@@ -1220,7 +1220,7 @@ bool zswap_store(struct folio *folio)
 	if (folio_test_large(folio))
 		return false;
 
-	if (!zswap_enabled || !tree)
+	if (!tree)
 		return false;
 
 	/*
@@ -1236,6 +1236,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
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

Re: [PATCH] mm/zswap: invalidate duplicate entry when !zswap_enabled

Quoted 8 lines · On Tue, Feb 27, 2024 at 02:26:54AM +0000, [email protected] wrote:

From: Chengming Zhou <[email protected]>

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.

Quoted 9 lines
Fixes 42c06a0e8ebe ("mm: kill frontswap")
Cc Nhat Pham <[email protected]>
Cc Yosry Ahmed <[email protected]>
(cherry picked from commit 678e54d4bb9a4822f8ae99690ac131c5d490cdb1)

What tree is this for?

#3 lore raw

Re: [PATCH] mm/zswap: invalidate duplicate entry when !zswap_enabled

Quoted 19 lines · Greg KH
Quoted 8 lines · On Tue, Feb 27, 2024 at 02:26:54AM +0000, [email protected] wrote:

From: Chengming Zhou <[email protected]>

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.

Quoted 9 lines
Fixes 42c06a0e8ebe ("mm: kill frontswap")
Cc Nhat Pham <[email protected]>
Cc Yosry Ahmed <[email protected]>
(cherry picked from commit 678e54d4bb9a4822f8ae99690ac131c5d490cdb1)
Quoted 1 line

What tree is this for?

Ah, for linux-6.7.y. I forgot to use your command line to send patch...

Thanks.

author maintainer
#4 lore raw

Re: [PATCH] mm/zswap: invalidate duplicate entry when !zswap_enabled

Quoted 20 lines · Chengming Zhou
Quoted 19 lines · Greg KH
Quoted 17 lines · On Tue, Feb 27, 2024 at 02:26:54AM +0000, [email protected] wrote:

From: Chengming Zhou <[email protected]>

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.

Fixes 42c06a0e8ebe ("mm: kill frontswap")
Cc Nhat Pham <[email protected]>
Cc Yosry Ahmed <[email protected]>
(cherry picked from commit 678e54d4bb9a4822f8ae99690ac131c5d490cdb1)
Quoted 3 lines
Quoted 1 line

What tree is this for?

Ah, for linux-6.7.y. I forgot to use your command line to send patch...

Thanks, both now queued up.

greg k-h