Re: [PATCH 13/14] zram: add dictionary support to zstd backend

From: Sergey Senozhatsky
Date: Sat May 04 2024 - 02:02:28 EST


On (24/05/03 18:17), Sergey Senozhatsky wrote:
> This adds support for pre-trained zstd dictionaries [1]
> Dictionary is loaded once (per-config) and then loaded to Cctx
> and Dctx by reference, so we don't allocate extra memory.
>
> The patch is a little non-trivial, as it seems that noone
> ever attempted to use dictionaries in the linux kernel
> port of zstd.
>
> It also uses GFP_KERNEL gfp in Cctx customAlloc(). We probably
> would want to do something about it. Either make sure that we
> always (somehow) fully setup all Cctx contexts from non-atomic
> context before we attempt to use them, come up with some sort
> of custom allocator or stop calling zcomp_compress() from atomic
> context.
>
> [1] https://github.com/facebook/zstd/blob/dev/programs/zstd.1.md#dictionary-builder

JFI
I reworked this patch quite significantly in v2 of the series.
I guess I'll post it soon.