Re: [PATCH v5 10/18] zsmalloc: factor out pool locking helpers
From: Yosry Ahmed
Date: Wed Feb 12 2025 - 20:13:05 EST
February 12, 2025 at 4:57 PM, "Sergey Senozhatsky" <senozhatsky@xxxxxxxxxxxx> wrote:
>
> On (25/02/12 16:18), Yosry Ahmed wrote:
>
> >
> > On Wed, Feb 12, 2025 at 03:27:08PM +0900, Sergey Senozhatsky wrote:
> >
> > We currently have a mix of migrate_{read,write}_lock() helpers
> >
> > that lock zspages, but it's zs_pool that actually has a ->migrate_lock
> >
> > access to which is opene-coded. Factor out pool migrate locking
> >
> > into helpers, zspage migration locking API will be renamed to
> >
> > reduce confusion.
> >
> >
> >
> > It's worth mentioning that zsmalloc locks sync not only migration,
> >
> > but also compaction.
> >
> >
> >
> > Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> >
> >
> >
> > FWIW I don't see a lot of value in the helpers (renaming the lock is
> >
> > useful tho).
> >
>
> I want to hide the details, keep them in one place and at some
>
> point *in the future* have the same "locking rules" as for zspage
>
> lock. Also *possibly* throwing a couple of lockdep assertions.
>
> So I'd prefer to abstract all of these.
I'd prefer to introduce the abstractions when they are needed tbh. Right now they just make the code less readable.