Re: [PATCH 1/2] crypto: zstd - use vmalloc() for stream workspaces
From: Rik van Riel
Date: Wed Nov 11 2026 - 11:08:09 EST
On Wed, 2026-11-11 at 07:07 -0800, Usama Arif wrote:
> The zstd acomp streams retain their workspaces after the last
> transform
> has been freed. The first is allocated during transform
> initialization;
> additional per-CPU streams are allocated on demand. They are released
> when the algorithm is unregistered.
>
> In a 4 KiB-page x86-64 build, each stream requests 1,566,281 bytes.
> If kvmalloc() succeeds via kmalloc(), it occupies an order-9 block
> (2 MiB). vmalloc() needs 383 backing pages (1,532 KiB), 516 KiB fewer
> per stream. Across 384 populated streams, that is 193.5 MiB less
>
Woah. Nice catch
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
>
Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>
--
All Rights Reversed.