All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosryahmed@google.com>
To: Chengming Zhou <zhouchengming@bytedance.com>
Cc: Nhat Pham <nphamcs@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/6] mm/zswap: invalidate zswap entry when swap entry free
Date: Mon, 5 Feb 2024 21:20:46 +0000	[thread overview]
Message-ID: <ZcFRLiazBrbhm4Gf@google.com> (raw)
In-Reply-To: <20240201-b4-zswap-invalidate-entry-v2-2-99d4084260a0@bytedance.com>

On Sun, Feb 04, 2024 at 03:06:00AM +0000, Chengming Zhou wrote:
> During testing I found there are some times the zswap_writeback_entry()
> return -ENOMEM, which is not we expected:
> 
> bpftrace -e 'kr:zswap_writeback_entry {@[(int32)retval]=count()}'
> @[-12]: 1563
> @[0]: 277221
> 
> The reason is that __read_swap_cache_async() return NULL because
> swapcache_prepare() failed. The reason is that we won't invalidate
> zswap entry when swap entry freed to the per-cpu pool, these zswap
> entries are still on the zswap tree and lru list.
> 
> This patch moves the invalidation ahead to when swap entry freed
> to the per-cpu pool, since there is no any benefit to leave trashy
> zswap entry on the tree and lru list.
> 
> With this patch:
> bpftrace -e 'kr:zswap_writeback_entry {@[(int32)retval]=count()}'
> @[0]: 259744
> 
> Note: large folio can't have zswap entry for now, so don't bother
> to add zswap entry invalidation in the large folio swap free path.
> 
> Reviewed-by: Nhat Pham <nphamcs@gmail.com>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

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



  reply	other threads:[~2024-02-05 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04  3:05 [PATCH v2 0/6] mm/zswap: optimize zswap lru list Chengming Zhou
2024-02-04  3:05 ` [PATCH v2 1/6] mm/zswap: add more comments in shrink_memcg_cb() Chengming Zhou
2024-02-04  3:06 ` [PATCH v2 2/6] mm/zswap: invalidate zswap entry when swap entry free Chengming Zhou
2024-02-05 21:20   ` Yosry Ahmed [this message]
2024-02-04  3:06 ` [PATCH v2 3/6] mm/zswap: stop lru list shrinking when encounter warm region Chengming Zhou
2024-02-04  3:06 ` [PATCH v2 4/6] mm/zswap: remove duplicate_entry debug value Chengming Zhou
2024-02-04  3:06 ` [PATCH v2 5/6] mm/zswap: only support zswap_exclusive_loads_enabled Chengming Zhou
2024-02-04  3:06 ` [PATCH v2 6/6] mm/zswap: zswap entry doesn't need refcount anymore Chengming Zhou

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=ZcFRLiazBrbhm4Gf@google.com \
    --to=yosryahmed@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=zhouchengming@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.