Re: [PATCH v9 14/19] zsmalloc: introduce new object mapping API
From: Sergey Senozhatsky
Date: Sun Mar 02 2025 - 21:42:41 EST
On (25/03/01 15:22), Herbert Xu wrote:
> Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote:
> >
> > New API splits functions by access mode:
> > - zs_obj_read_begin(handle, local_copy)
> > Returns a pointer to handle memory. For objects that span two
> > physical pages a local_copy buffer is used to store object's
> > data before the address is returned to the caller. Otherwise
> > the object's page is kmap_local mapped directly.
>
> I presume this buffer is always given to the compression algorithm
> to decompress? In that case there should be no need to linearise
> them at all.
>
> Just return a two-entry SG list, and give it to the Crypto API
> to deal with. Both software and hardware algorithms can handle
> non-linear input. Yes software decompression is currently
> linearising all input with a copy, but that is no different
> to the copy that you're making in zsmalloc.
>
> So please change this API to create an SG list instead of copying.
> That way we can then optimise the software decompression to read
> non-linear input directly and skip the copying altogether.
A heads up:
Discussed with Herbert privately, we will look into SG-list API
later (future dev cycles).