[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <vtb3tv7bgliyvhu4waovse774gtjm7iw47bjnmz7elxd3hpi5s@zdosair757qz>
Date: Sat, 22 Feb 2025 07:29:36 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
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 (25/02/21 19:52), Yosry Ahmed wrote:
> 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 :)
YOLO-by: :)
Thanks for all your help!
Powered by blists - more mailing lists