Skip to content

crypto: use vmalloc() for large stream workspaces

Usama Arif linux-crypto linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2crypto: zstd - use vmalloc() for stream workspacescrypto/zstd.c+2 -23 replies
2/2crypto: deflate - use vmalloc() for stream workspacescrypto/deflate.c+3 -23 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchRik van RielJohannes WeinerChris Down
1/2R-b R-b R-b T-b
2/2R-b R-b R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/2] crypto: use vmalloc() for large stream workspaces

The zstd and deflate acomp implementations retain per-CPU stream workspaces until the algorithms are unregistered. On x86-64 with 4 KiB pages, kvmalloc() can back them with order-9 and order-6 kmalloc() blocks, respectively.

Use vmalloc() and vfree() instead. For a server with 384 CPUs, if we have streams on all of the CPUs and kvmalloc() takes the kmalloc() path for every stream, their workspaces use 193.5 MiB more for zstd and 42 MiB for deflate.

In five before/after boot pairs on a 96-vCPU x86-64 VM with 8 GiB RAM, the test populated both algorithms crypto workspaces on every CPU. All 192 baseline workspaces used kmalloc() without these patches. The patches reduced workspace backing by 48.375 MiB for zstd and 10.5 MiB for deflate —58.875 MiB combined—in each pair.

In five before/after runs in a 4-vCPU x86-64 VM, median compression and decompression throughput changed by less than 1% (-0.93% to +0.64%). Inputs were 4 KiB and 64 KiB synthetic buffers containing pseudorandom data or a 50/50 mix of repeating-pattern and pseudorandom bytes. The differences were within the observed run-to-run variation.

Usama Arif (2):
crypto: zstd - use vmalloc() for stream workspaces
crypto: deflate - use vmalloc() for stream workspaces

 crypto/deflate.c | 5 +++--
 crypto/zstd.c    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0-Meta