From: Chengming Zhou <zhouchengming@bytedance.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: yosryahmed@google.com, hannes@cmpxchg.org, nphamcs@gmail.com,
Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan@kernel.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [External] Re: [PATCH 0/2] mm/zsmalloc: simplify synchronization between zs_page_migrate() and free_zspage()
Date: Wed, 28 Feb 2024 10:22:15 +0800 [thread overview]
Message-ID: <55359a0d-fced-431c-a8fe-734c739b0158@bytedance.com> (raw)
In-Reply-To: <20240228015720.GC11972@google.com>
On 2024/2/28 09:57, Sergey Senozhatsky wrote:
> On (24/02/27 03:02), Chengming Zhou wrote:
>> Hello,
>>
>> free_zspage() has to hold locks of all pages, since zs_page_migrate()
>> path rely on this page lock to protect the race between zs_free() and
>> it, so it can safely get zspage from page->private.
>>
>> But this way is not good and simple enough:
>>
>> 1. Since zs_free() couldn't be sleepable, it can only trylock pages,
>> or has to kick_deferred_free() to defer that to a work.
>>
>> 2. Even in the worker context, async_free_zspage() can't simply
>> lock all pages in lock_zspage(), it's still trylock because of
>> the race between zs_free() and zs_page_migrate(). Please see
>> the commit 2505a981114d ("zsmalloc: fix races between asynchronous
>> zspage free and page migration") for details.
>>
>> Actually, all free_zspage() needs is to get zspage from page safely,
>> we can use RCU to achieve it easily. Then free_zspage() don't need to
>> hold locks of all pages, so don't need the deferred free mechanism
>> at all. This patchset implements it and remove all of deferred free
>> related code.
>>
>> Thanks for review and comments!
>>
>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
>
> JFI, recovered from the SPAM folder
> "The sender hasn't authenticated this message"
Sorry for this, I thought the problem was fixed after testing with my own
Gmail last time. But it turns out my corporation email still sometimes has
this problem.
I will always use linux.dev email in the future to avoid these problems.
Thanks for your time!
next prev parent reply other threads:[~2024-02-28 2:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 3:02 Chengming Zhou
2024-02-27 3:02 ` [PATCH 1/2] mm/zsmalloc: don't hold locks of all pages when free_zspage() Chengming Zhou
2024-02-28 4:33 ` Sergey Senozhatsky
2024-02-28 5:14 ` Chengming Zhou
2024-02-28 5:29 ` Sergey Senozhatsky
2024-02-28 5:42 ` Chengming Zhou
2024-02-28 6:07 ` Sergey Senozhatsky
2024-02-28 6:01 ` Sergey Senozhatsky
2024-02-28 6:44 ` Chengming Zhou
2024-02-28 6:14 ` Sergey Senozhatsky
2024-02-28 6:49 ` Chengming Zhou
2024-02-27 3:02 ` [PATCH 2/2] mm/zsmalloc: remove the deferred free mechanism Chengming Zhou
2024-02-28 1:57 ` [PATCH 0/2] mm/zsmalloc: simplify synchronization between zs_page_migrate() and free_zspage() Sergey Senozhatsky
2024-02-28 2:22 ` Chengming Zhou [this message]
2024-02-28 3:54 ` Sergey Senozhatsky
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=55359a0d-fced-431c-a8fe-734c739b0158@bytedance.com \
--to=zhouchengming@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=nphamcs@gmail.com \
--cc=senozhatsky@chromium.org \
--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