[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tc37ejw7blw4gglcrlik6faak24zml5pszqba3gam5ttbf4u3n@5jxgj5m7kump>
Date: Thu, 30 Jan 2025 13:17:53 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: 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,
Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: Re: [PATCHv1 4/6] zsmalloc: introduce new object mapping API
On (25/01/30 12:21), Sergey Senozhatsky wrote:
> [..]
> > > + 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.
Ah, now I see why I didn't do it. off += ZS_HANDLE_SIZE before
if (off + size <= PAGE_SIZE) messes it up.
Powered by blists - more mailing lists