Commit 56c67049 authored by Johannes Weiner's avatar Johannes Weiner Committed by Andrew Morton

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.orgSigned-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Suggested-by: default avatarYosry Ahmed <yosryahmed@google.com>
Reviewed-by: default avatarYosry Ahmed <yosryahmed@google.com>
Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Barry Song <song.bao.hua@hisilicon.com>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 68af0514
...@@ -1370,9 +1370,7 @@ bool zswap_store(struct folio *folio) ...@@ -1370,9 +1370,7 @@ bool zswap_store(struct folio *folio)
spin_lock(&tree->lock); spin_lock(&tree->lock);
while (zswap_rb_insert(&tree->rbroot, entry, &dupentry) == -EEXIST) { while (zswap_rb_insert(&tree->rbroot, entry, &dupentry) == -EEXIST) {
zswap_duplicate_entry++; zswap_duplicate_entry++;
/* remove from rbtree */ zswap_invalidate_entry(tree, dupentry);
zswap_rb_erase(&tree->rbroot, dupentry);
zswap_entry_put(tree, dupentry);
} }
if (entry->length) { if (entry->length) {
spin_lock(&entry->pool->lru_lock); spin_lock(&entry->pool->lru_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment