[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4slya4kbgfvkvlgkvwep2cgghs233lfhfpctfrrgvho4fpgzwr@cjp643bd4ml6>
Date: Thu, 30 Jan 2025 12:21:14 +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>, Minchan Kim <minchan@...nel.org>,
Johannes Weiner <hannes@...xchg.org>, Nhat Pham <nphamcs@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv1 4/6] zsmalloc: introduce new object mapping API
On (25/01/29 17:31), Yosry Ahmed wrote:
> On Wed, Jan 29, 2025 at 03:43:50PM +0900, Sergey Senozhatsky wrote:
[..]
> > The old API will stay around until the remaining users switch
> > to the new one. After that we'll also remove zsmalloc per-CPU
> > buffer and CPU hotplug handling.
>
> I will propose removing zbud (in addition to z3fold) soon. If that gets
> in then we'd only need to update zpool and zswap code to use the new
> API. I can take care of that if you want.
Sounds like a plan. I think I saw zbud deprecation patch (along with z3fold
removal). I guess you still want to keep zpool, just because it's there
already?
> > Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
>
> I have a couple of questions below, but generally LGTM:
>
> Reviewed-by: Yosry Ahmed <yosry.ahmed@...ux.dev>
Thanks.
[..]
> > +void zs_obj_read_end(struct zs_pool *pool, unsigned long handle,
> > + void *handle_mem);
> > +void *zs_obj_read_begin(struct zs_pool *pool, unsigned long handle,
> > + void *local_copy);
>
> Nit: Any reason to put 'end' before 'begin'? Same for the function
> definitions.
An old habit, I just put release() before init() (or end() before
begin()) because often times you call end() from begin() error path.
Not in this particular case, but I just do that semi-automatically.
[..]
> > + if (off + class->size <= PAGE_SIZE) {
> > + /* this object is contained entirely within a page */
> > + void *dst = kmap_local_zpdesc(zpdesc);
> > +
> > + if (!ZsHugePage(zspage))
> > + off += ZS_HANDLE_SIZE;
> > + memcpy(dst + off, handle_mem, mem_len);
> > + kunmap_local(dst);
> > + } else {
> > + size_t sizes[2];
> > +
> > + /* this object spans two pages */
> > + off += ZS_HANDLE_SIZE;
>
> Are huge pages always stored in a single page? If yes, can we just do
> this before the if block for both cases:
Yes.
> if (!ZsHugePage(zspage))
> off += ZS_HANDLE_SIZE;
Looks good.
Powered by blists - more mailing lists