Skip to contentSkip to conversation

mm-zswap-remove-unnecessary-trees-cleanups-in-zswap_swapoff.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Feb 22, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: zswap: remove unnecessary trees cleanups in zswap_swapoff()
has been removed from the -mm tree. Its filename was
mm-zswap-remove-unnecessary-trees-cleanups-in-zswap_swapoff.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Yosry Ahmed <[email protected]>
Subject: mm: zswap: remove unnecessary trees cleanups in zswap_swapoff()
Date: Wed, 24 Jan 2024 04:51:12 +0000

During swapoff, try_to_unuse() makes sure that zswap_invalidate() is called for all swap entries before zswap_swapoff() is called. This means that all zswap entries should already be removed from the tree. Simplify zswap_swapoff() by removing the trees cleanup code, and leave an assertion in its place.

---

 mm/zswap.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
mm/zswap.c renamed from mm/zswap.c~mm-zswap-remove-unnecessary-trees-cleanups-in-zswap_swapoff +3 -13
@@ -1808,19 +1808,9 @@ void zswap_swapoff(int type)
 	if (!trees)
 		return;
 
-	for (i = 0; i < nr_zswap_trees[type]; i++) {
-		struct zswap_tree *tree = trees + i;
-		struct zswap_entry *entry, *n;
-
-		/* walk the tree and free everything */
-		spin_lock(&tree->lock);
-		rbtree_postorder_for_each_entry_safe(entry, n,
-						     &tree->rbroot,
-						     rbnode)
-			zswap_free_entry(entry);
-		tree->rbroot = RB_ROOT;
-		spin_unlock(&tree->lock);
-	}
+	/* try_to_unuse() invalidated all the entries already */
+	for (i = 0; i < nr_zswap_trees[type]; i++)
+		WARN_ON_ONCE(!RB_EMPTY_ROOT(&trees[i].rbroot));
 
 	kvfree(trees);
 	nr_zswap_trees[type] = 0;

_

Patches currently in -mm which might be from [email protected] are