Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Set KMC_NOEMERGENCY for zlib workspaces
Browse files Browse the repository at this point in the history
The workspace required by zlib to perform compression is roughly
512MB (order-7).  These allocations are so large that we should
never attempt to directly kmalloc an emergency object for them.

It is far preferable to asynchronously vmalloc an additional slab
in case it's needed.  Then simply block waiting for an existing
object to be released or for the new slab to be allocated.

This can be accomplished by disabling emergency slab objects by
passing the KMC_NOEMERGENCY flag at slab creation time.

Signed-off-by: Brian Behlendorf <[email protected]>
openzfs/zfs#917
  • Loading branch information
behlendorf committed Sep 7, 2012
1 parent cb5c2ac commit 95331f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions module/spl/spl-zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@ spl_zlib_init(void)
size = MAX(spl_zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
zlib_inflate_workspacesize());

zlib_workspace_cache = kmem_cache_create("spl_zlib_workspace_cache",
size, 0, NULL, NULL, NULL, NULL, NULL, KMC_VMEM);
zlib_workspace_cache = kmem_cache_create(
"spl_zlib_workspace_cache",
size, 0, NULL, NULL, NULL, NULL, NULL,
KMC_VMEM | KMC_NOEMERGENCY);
if (!zlib_workspace_cache)
SRETURN(1);

Expand Down

0 comments on commit 95331f4

Please sign in to comment.