summaryrefslogtreecommitdiff
path: root/mm/zswap.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2024-01-29 20:36:39 -0500
committerAndrew Morton <akpm@linux-foundation.org>2024-02-22 10:24:42 -0800
commit7dd1f7f0fc1c98525cbadf954eb6b7672ad4acea (patch)
treedb51f0c3ae312c783e1b956441072c6cac49e072 /mm/zswap.c
parent5b297f70bb26b9041d5badd0d51d9227e25fc1eb (diff)
mm: zswap: move zswap_invalidate_entry() to related functions
Move it up to the other tree and refcounting functions. Link: https://lkml.kernel.org/r/20240130014208.565554-4-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Nhat Pham <nphamcs@gmail.com> Acked-by: Yosry Ahmed <yosryahmed@google.com> Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/zswap.c')
-rw-r--r--mm/zswap.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mm/zswap.c b/mm/zswap.c
index 3df8b6329cf5..0dfd410d1b3c 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -558,6 +558,18 @@ static void zswap_entry_put(struct zswap_entry *entry)
}
}
+/*
+ * If the entry is still valid in the tree, drop the initial ref and remove it
+ * from the tree. This function must be called with an additional ref held,
+ * otherwise it may race with another invalidation freeing the entry.
+ */
+static void zswap_invalidate_entry(struct zswap_tree *tree,
+ struct zswap_entry *entry)
+{
+ if (zswap_rb_erase(&tree->rbroot, entry))
+ zswap_entry_put(entry);
+}
+
/*********************************
* shrinker functions
**********************************/
@@ -808,18 +820,6 @@ static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor)
return NULL;
}
-/*
- * If the entry is still valid in the tree, drop the initial ref and remove it
- * from the tree. This function must be called with an additional ref held,
- * otherwise it may race with another invalidation freeing the entry.
- */
-static void zswap_invalidate_entry(struct zswap_tree *tree,
- struct zswap_entry *entry)
-{
- if (zswap_rb_erase(&tree->rbroot, entry))
- zswap_entry_put(entry);
-}
-
static enum lru_status shrink_memcg_cb(struct list_head *item, struct list_lru_one *l,
spinlock_t *lock, void *arg)
{