[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z7jZfIaqMRTLYp23@google.com>
Date: Fri, 21 Feb 2025 19:52:28 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Hillf Danton <hdanton@...a.com>, Kairui Song <ryncsn@...il.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Minchan Kim <minchan@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 11/17] zsmalloc: make zspage lock preemptible
On Fri, Feb 21, 2025 at 06:38:04PM +0900, Sergey Senozhatsky wrote:
> In order to implement preemptible object mapping we need a zspage lock
> that satisfies several preconditions:
> - it should be reader-write type of a lock
> - it should be possible to hold it from any context, but also being
> preemptible if the context allows it
> - we never sleep while acquiring but can sleep while holding in read
> mode
>
> An rwsemaphore doesn't suffice, due to atomicity requirements, rwlock
> doesn't satisfy due to reader-preemptability requirement. It's also
> worth to mention, that per-zspage rwsem is a little too memory heavy
> (we can easily have double digits megabytes used only on rwsemaphores).
>
> Switch over from rwlock_t to a atomic_t-based implementation of a
> reader-writer semaphore that satisfies all of the preconditions.
>
> The spin-lock based zspage_lock is suggested by Hillf Danton.
>
> Suggested-by: Hillf Danton <hdanton@...a.com>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
FWIW the code looks correct to me, but I don't trust my locking
knowledge enough to give a Reviewed-by :)
Powered by blists - more mailing lists