RE: zram: Optimize LZ4 dictionary compression performance

From: gao xu

Date: Wed Mar 11 2026 - 00:01:58 EST


>
> On (26/03/10 02:54), gao xu wrote:
> > + memcpy(zctx->cstrm, &drv->base_cstream,
> > + sizeof(*zctx->cstrm));
>
> Do we need to do this memcpy() every time?
memcpy is a replacement for LZ4_loadDict. LZ4_loadDict updates the LZ4 hash table using the dictionary. Furthermore, LZ4 also updates its hash table with the results of the previous compression. Therefore, to ensure the compression dictionary remains effective, we would need to reset the hash table every time, which would involve executing memcpy() or LZ4_loadDict(). (Please correct me if there's any misunderstanding here.)
> A nit: if it cannot fit on one line, then let's align sizeof(*zctx->cstrm) with "(".
Received, thank you.