[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240228015720.GC11972@google.com>
Date: Wed, 28 Feb 2024 10:57:20 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Chengming Zhou <zhouchengming@...edance.com>
Cc: yosryahmed@...gle.com, Sergey Senozhatsky <senozhatsky@...omium.org>,
hannes@...xchg.org, nphamcs@...il.com,
Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 0/2] mm/zsmalloc: simplify synchronization between
zs_page_migrate() and free_zspage()
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@...edance.com>
JFI, recovered from the SPAM folder
"The sender hasn't authenticated this message"
Powered by blists - more mailing lists