Re: [PATCH v2] zsmalloc: Fix address alignment in zspage for performance improvement
From: Sergey Senozhatsky
Date: Wed Jan 29 2025 - 06:46:00 EST
Cc-ing Andrew and Yosry
On (25/01/29 16:28), Kenny Cheng wrote:
> The zspage consists of multiple objects, each containing a "link struct"
> to connect to the next object. The "link struct" is placed at the
> beginning of each object. On a 32-bit system, the size of the "link
> struct" is 4 bytes, which means the address returned by `zs_map_object`
> is always 4-byte aligned.
Sorry, you picked a rather unlucky time to patch zsmalloc, as it
goes through some intrusive changes. We need to stabilize those
changes first.
> For better performance, zram compression/decompression is offloaded to
> hardware designed by the IC vendor. For example, Realtek's hardware
> requires 16-byte alignment. However, due to the 4-byte alignment,
> a `memcpy` operation is needed to move data from the 4-byte aligned
> address to the 16-byte aligned address, which negatively impacts zram
> performance.
Hmm, I don't know. If we change zsmalloc to make some H/W happy, how
do we make sure that something that is good for Realtek is not "bad"
for some other H/W?
I'm very unsure about having "vendor-specific" (by the way, is that
out-of-tree compression/decompression driver?) changes in zsmalloc.