linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosryahmed@google.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Nhat Pham <nphamcs@gmail.com>,
	 Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] mm: zswap: use zswap_invalidate_entry() for duplicates
Date: Thu, 27 Jul 2023 11:09:03 -0700	[thread overview]
Message-ID: <CAJD7tkatLxSd_qv_g1AS-5dEZrX1RYHrqjUuzee8iOvo+eRxAQ@mail.gmail.com> (raw)
In-Reply-To: <20230727162343.1415598-2-hannes@cmpxchg.org>

On Thu, Jul 27, 2023 at 9:23 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> 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>

Reviewed-by: Yosry Ahmed <yosryahmed@google.com>

Thanks!

> ---
>  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
>


  reply	other threads:[~2023-07-27 18:09 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 ` [PATCH 1/3] mm: zswap: use zswap_invalidate_entry() for duplicates Johannes Weiner
2023-07-27 18:09   ` Yosry Ahmed [this message]
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=CAJD7tkatLxSd_qv_g1AS-5dEZrX1RYHrqjUuzee8iOvo+eRxAQ@mail.gmail.com \
    --to=yosryahmed@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=cerasuolodomenico@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.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