From: Johannes Weiner <hannes@cmpxchg.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Yosry Ahmed <yosryahmed@google.com>,
Nhat Pham <nphamcs@gmail.com>,
Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] mm: zswap: use zswap_invalidate_entry() for duplicates
Date: Thu, 27 Jul 2023 12:22:23 -0400 [thread overview]
Message-ID: <20230727162343.1415598-2-hannes@cmpxchg.org> (raw)
In-Reply-To: <20230727162343.1415598-1-hannes@cmpxchg.org>
Minor cleanup. Instead of open-coding the tree deletion and the put,
use the zswap_invalidate_entry() convenience helper.
Suggested-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
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
next prev parent reply other threads:[~2023-07-27 16:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 16:22 [PATCH 0/3] mm: zswap: three cleanups Johannes Weiner
2023-07-27 16:22 ` Johannes Weiner [this message]
2023-07-27 18:09 ` [PATCH 1/3] mm: zswap: use zswap_invalidate_entry() for duplicates Yosry Ahmed
2023-07-27 16:22 ` [PATCH 2/3] mm: zswap: tighten up entry invalidation Johannes Weiner
2023-07-27 18:14 ` Yosry Ahmed
2023-07-27 16:22 ` [PATCH 3/3] mm: zswap: kill zswap_get_swap_cache_page() Johannes Weiner
2023-07-27 18:29 ` Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230727162343.1415598-2-hannes@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox