From: Chengming Zhou <zhouchengming@bytedance.com>
To: Nhat Pham <nphamcs@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Yosry Ahmed <yosryahmed@google.com>,
linux-kernel@vger.kernel.org,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, Chris Li <chriscli@google.com>
Subject: Re: [PATCH 2/2] mm/zswap: split zswap rb-tree
Date: Fri, 19 Jan 2024 14:24:21 +0800 [thread overview]
Message-ID: <fa586d2c-179c-4315-9e32-0832cf22e186@bytedance.com> (raw)
In-Reply-To: <CAKEwX=Op6XTawUZg-4pDM70z4kB4-5Wo6Ss+ptyzkd+Ub3PDEQ@mail.gmail.com>
On 2024/1/19 03:24, Nhat Pham wrote:
> On Wed, Jan 17, 2024 at 1:23 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
>
> That's really impressive, especially the sys time reduction :) Well done.
>
Thanks!
>>
>> So there are clearly improvements.
>>
>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
>
> Code looks solid too. I haven't read the xarray patch series too
> closely yet, but this patch series is clearly already an improvement.
> It is simple, with existing precedent (from swap cache), and
> experiments show that it works quite well to improve zswap's
> performance.
>
> If the xarray patch proves to be even better, we can always combine it
> with this approach (a per-range xarray?), or replace it with the
> xarray. But for now:
>
> Acked-by: Nhat Pham <nphamcs@gmail.com>
>
Right, I agree. We should combine both approaches.
next prev parent reply other threads:[~2024-01-19 6:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 9:23 [PATCH 0/2] mm/zswap: optimize the scalability of " Chengming Zhou
2024-01-17 9:23 ` [PATCH 1/2] mm/zswap: make sure each swapfile always have " Chengming Zhou
2024-01-18 15:05 ` Johannes Weiner
2024-01-18 17:37 ` Yosry Ahmed
2024-01-18 18:16 ` Nhat Pham
2024-01-17 9:23 ` [PATCH 2/2] mm/zswap: split " Chengming Zhou
2024-01-18 15:11 ` Johannes Weiner
2024-01-19 6:20 ` Chengming Zhou
2024-01-18 19:24 ` Nhat Pham
2024-01-19 6:24 ` Chengming Zhou [this message]
2024-01-17 18:37 ` [PATCH 0/2] mm/zswap: optimize the scalability of " Yosry Ahmed
2024-01-17 23:41 ` Chris Li
2024-01-17 23:47 ` Yosry Ahmed
2024-01-18 0:17 ` Chris Li
2024-01-18 0:34 ` Yosry Ahmed
2024-01-18 1:03 ` Chris Li
2024-01-18 3:51 ` Yosry Ahmed
2024-01-18 0:49 ` Nhat Pham
2024-01-18 15:34 ` Johannes Weiner
2024-01-18 17:30 ` Yosry Ahmed
2024-01-18 18:06 ` Johannes Weiner
2024-01-18 18:37 ` Yosry Ahmed
2024-01-19 6:40 ` 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=fa586d2c-179c-4315-9e32-0832cf22e186@bytedance.com \
--to=zhouchengming@bytedance.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=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