From: Yosry Ahmed <yosryahmed@google.com>
To: Chengming Zhou <zhouchengming@bytedance.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Nhat Pham <nphamcs@gmail.com>, Chris Li <chriscli@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH v2 2/2] mm/zswap: split zswap rb-tree
Date: Mon, 22 Jan 2024 11:49:05 -0800 [thread overview]
Message-ID: <CAJD7tkbYv_TfEZ3Dj1JE=NXA323MdxGR9ib34PUoCmbfFaSCRQ@mail.gmail.com> (raw)
In-Reply-To: <20240117-b4-zswap-lock-optimize-v2-2-b5cc55479090@bytedance.com>
On Fri, Jan 19, 2024 at 3:22 AM Chengming Zhou
<zhouchengming@bytedance.com> wrote:
>
> Each swapfile has one rb-tree to search the mapping of swp_entry_t to
> zswap_entry, that use a spinlock to protect, which can cause heavy lock
> contention if multiple tasks zswap_store/load concurrently.
>
> Optimize the scalability problem by splitting the zswap rb-tree into
> multiple rb-trees, each corresponds to SWAP_ADDRESS_SPACE_PAGES (64M),
> just like we did in the swap cache address_space splitting.
>
> Although this method can't solve the spinlock contention completely, it
> can mitigate much of that contention. Below is the results of kernel build
> in tmpfs with zswap shrinker enabled:
>
> linux-next zswap-lock-optimize
> real 1m9.181s 1m3.820s
> user 17m44.036s 17m40.100s
> sys 7m37.297s 4m54.622s
>
> So there are clearly improvements.
If/when you respin this, can you mention that testing was done with a
single swapfile? I assume the improvements will be less with multiple
swapfiles as lock contention should be better.
>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Acked-by: Nhat Pham <nphamcs@gmail.com>
I think the diff in zswap_swapoff() should be much simpler with the
tree(s) cleanup removed. Otherwise LGTM.
Acked-by: Yosry Ahmed <yosryahmed@google.com>
next prev parent reply other threads:[~2024-01-22 19:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 11:22 [PATCH v2 0/2] mm/zswap: optimize the scalability of " Chengming Zhou
2024-01-19 11:22 ` [PATCH v2 1/2] mm/zswap: make sure each swapfile always have " Chengming Zhou
2024-01-19 11:22 ` [PATCH v2 2/2] mm/zswap: split " Chengming Zhou
2024-01-22 19:49 ` Yosry Ahmed [this message]
2024-01-23 7:46 ` 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='CAJD7tkbYv_TfEZ3Dj1JE=NXA323MdxGR9ib34PUoCmbfFaSCRQ@mail.gmail.com' \
--to=yosryahmed@google.com \
--cc=akpm@linux-foundation.org \
--cc=chriscli@google.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox