Minor cleanup. Instead of open-coding the tree deletion and the put, use the zswap_invalidate_entry() convenience helper. Suggested-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx> --- mm/zswap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 583ef7b84dc3..e123b1c7981c 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1344,9 +1344,7 @@ bool zswap_store(struct page *page) 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); -- 2.41.0