linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosryahmed@google.com>
To: 贺中坤 <hezhongkun.hzk@bytedance.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, nphamcs@gmail.com,
	 sjenning@redhat.com, ddstreet@ieee.org,
	vitaly.wool@konsulko.com,  linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Ying <ying.huang@intel.com>
Subject: Re: [External] Re: [PATCH] mm:zswap: fix zswap entry reclamation failure in two scenarios
Date: Wed, 15 Nov 2023 20:09:49 -0800	[thread overview]
Message-ID: <CAJD7tkZHwg_u7UhzugVmmH6-FNORb+D+5SyMX6cGefp93uZr_Q@mail.gmail.com> (raw)
In-Reply-To: <CACSyD1Nav7+zppx3BZS8vU5uF3AaBin0XOKCdtdQ1d6sA4wu9w@mail.gmail.com>

On Wed, Nov 15, 2023 at 7:33 PM 贺中坤 <hezhongkun.hzk@bytedance.com> wrote:
>
> On Thu, Nov 16, 2023 at 4:13 AM Yosry Ahmed <yosryahmed@google.com> wrote:
> >
> > I think we may need to try to lock the folio. Otherwise we may race
> > with reclaim reading the dirty bit before we set it.
> >
> > Taking a step back, this seems like we are going behind exclusive
> > loads. We "should" keep the page in zswap as exclusive loads are
> > disabled and the page is not yet invalidated from zswap (the swap
> > entry is still in use). What you are trying to do here is sneakily
> > drop the page from zswap as if we wrote it back, but we didn't.
>
> If  we want to reclaim the cached zswap_entry, Writing back might
> be the easy way.
>
> > We just know that it was already loaded from zswap. We are essentially
> > making the previous load exclusive retroactively.
> >
> > Is there a reason why exclusive loads cannot be enabled to achieve the
> > same result in the (arguably) correct way?
> >
>
> zswap_exclusive_loads is not enabled by default, so the shrink_worker
> may fail if there are many cached zswap_entries on the zswap_pool->lru.


It can be enabled at runtime, or enabled by default by using
CONFIG_ZSWAP_EXCLUSIVE_LOADS_DEFAULT_ON.

>
>
> Is it possible to make zswap_exclusive_loads the only way in zswap_load?
> It only makes sense when the page is read and no longer dirty.
> If the page is read frequently, it should stay in cache rather than zswap.
> The benefit of doing this is very small, two copies of the same page
> in memory.


The reason I added it behind runtime and config knobs is to preserve
the existing behavior in case someone depends on it. At Google, we
have been using exclusive loads for a long time. If other users of
zswap agree to make this the default behavior or make it the only way
to do zswap loads I don't have a problem with it.

>
>
> Thanks.


  reply	other threads:[~2023-11-16  4:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13 13:06 Zhongkun He
2023-11-13 15:11 ` Nhat Pham
2023-11-14  5:21   ` [External] " 贺中坤
2023-11-14 16:30     ` Nhat Pham
2023-11-15 12:12       ` 贺中坤
2023-11-14 17:16 ` Yosry Ahmed
2023-11-15 12:53   ` [External] " 贺中坤
2023-11-15 20:12     ` Yosry Ahmed
2023-11-16  3:33       ` 贺中坤
2023-11-16  4:09         ` Yosry Ahmed [this message]
2023-11-16  4:23           ` 贺中坤
2023-11-16  8:31   ` Huang, Ying
2023-11-16 10:34     ` [External] " 贺中坤
2023-11-16 20:11   ` Chris Li
2023-11-16 20:18     ` Yosry Ahmed
2023-11-16 20:30       ` Chris Li
2023-11-16 20:45         ` Yosry Ahmed
2023-11-17 23:30           ` Chris Li
2023-11-17  9:56         ` [External] " Zhongkun He
2023-11-17 23:47           ` Chris Li
2023-11-18  1:45             ` Zhongkun He
2023-11-18 18:43               ` Nhat Pham
2023-11-19  8:29                 ` Chris Li
2023-11-20  2:42                 ` Zhongkun He
2023-11-19  8:23               ` Chris Li
2023-11-20  3:16                 ` Zhongkun He
2023-11-20  3:18         ` Huang, Ying
2023-11-20  5:31           ` Chris Li
2023-11-20  5:39             ` Huang, Ying
2023-11-20  5:51               ` Chris Li
2023-11-20 18:52           ` Yosry Ahmed
2023-11-21  0:54             ` Huang, Ying
2023-11-21  1:15               ` Yosry Ahmed
2023-11-21  1:53                 ` Huang, Ying
2023-11-21  2:46                   ` Yosry Ahmed
2023-11-21  3:32                     ` Huang, Ying
2023-11-21  3:37                       ` 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=CAJD7tkZHwg_u7UhzugVmmH6-FNORb+D+5SyMX6cGefp93uZr_Q@mail.gmail.com \
    --to=yosryahmed@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=hannes@cmpxchg.org \
    --cc=hezhongkun.hzk@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=sjenning@redhat.com \
    --cc=vitaly.wool@konsulko.com \
    --cc=ying.huang@intel.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