Re: [RFC PATCH 5/6] zsmalloc: introduce handle mapping API
From: Sergey Senozhatsky
Date: Wed Jan 29 2025 - 00:41:00 EST
On (25/01/28 01:36), Yosry Ahmed wrote:
> zs_obj_read_start(.., buf)
> {
> if (contained in one page)
> return kmapped obj
> else
> memcpy to buf
> return buf
> }
>
> zs_obj_read_end(.., buf)
> {
> if (container in one page)
> kunmap
> }
So it seems we can optimize things a little further by avoiding more
memcpy() calls. Namely, for WO directions [on objects that span two
pages] the caller first memcpy() data to a provided temp buffer (per-CPU
buffer at this moment) and then during zs_unmap() memcpy() from that temp
buffer to physical pages that object spans accross. We can skip this memcpy()
and instead write to physical pages straight from the compression buffer.
I'll post an updated series shortly.