From: Johannes Weiner Date: Thu, 27 Jul 2023 16:22:23 +0000 (-0400) Subject: mm: zswap: use zswap_invalidate_entry() for duplicates X-Git-Tag: v6.6.7~1970^2~247 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56c67049c0ee135868e83ce36ac8d3e037e03f82;p=platform%2Fkernel%2Flinux-starfive.git mm: zswap: use zswap_invalidate_entry() for duplicates Patch series "mm: zswap: three cleanups". Three small cleanups to zswap, the first one suggested by Yosry during the frontswap removal. This patch (of 3): Minor cleanup. Instead of open-coding the tree deletion and the put, use the zswap_invalidate_entry() convenience helper. Link: https://lkml.kernel.org/r/20230727162343.1415598-1-hannes@cmpxchg.org Link: https://lkml.kernel.org/r/20230727162343.1415598-2-hannes@cmpxchg.org Signed-off-by: Johannes Weiner Suggested-by: Yosry Ahmed Reviewed-by: Yosry Ahmed Cc: Domenico Cerasuolo Cc: Nhat Pham Cc: Barry Song Cc: Seth Jennings Cc: Vitaly Wool Signed-off-by: Andrew Morton --- diff --git a/mm/zswap.c b/mm/zswap.c index 7cc4a2ba..93707a1 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1370,9 +1370,7 @@ insert_entry: spin_lock(&tree->lock); while (zswap_rb_insert(&tree->rbroot, entry, &dupentry) == -EEXIST) { zswap_duplicate_entry++; - /* remove from rbtree */ - zswap_rb_erase(&tree->rbroot, dupentry); - zswap_entry_put(tree, dupentry); + zswap_invalidate_entry(tree, dupentry); } if (entry->length) { spin_lock(&entry->pool->lru_lock);