btrfs: disable allocation warnings for compression workspaces
authorDavid Sterba <dsterba@suse.com>
Mon, 22 May 2023 14:51:10 +0000 (16:51 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:34 +0000 (13:59 +0200)
The workspaces for compression are typically much larger than a page and
for high zstd levels in the range of megabytes. There's a fallback to
vmalloc but this can still fail (see the report).

Some of the workspaces are preallocated at module load time so we have a
safe fallback, otherwise when a new workspace is needed it's allocated
but if this fails then the process waits. Which means the warning is
only causing noise and we can use the GFP flag to disable it.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217466
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/lzo.c
fs/btrfs/zlib.c
fs/btrfs/zstd.c

index 3a095b9c6373eaba53d8751cb645b8cf01548dae..d3fcfc628a4fe58ff275a4460cd86bf4c7e4981b 100644 (file)
@@ -88,9 +88,9 @@ struct list_head *lzo_alloc_workspace(unsigned int level)
        if (!workspace)
                return ERR_PTR(-ENOMEM);
 
-       workspace->mem = kvmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
-       workspace->buf = kvmalloc(WORKSPACE_BUF_LENGTH, GFP_KERNEL);
-       workspace->cbuf = kvmalloc(WORKSPACE_CBUF_LENGTH, GFP_KERNEL);
+       workspace->mem = kvmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL | __GFP_NOWARN);
+       workspace->buf = kvmalloc(WORKSPACE_BUF_LENGTH, GFP_KERNEL | __GFP_NOWARN);
+       workspace->cbuf = kvmalloc(WORKSPACE_CBUF_LENGTH, GFP_KERNEL | __GFP_NOWARN);
        if (!workspace->mem || !workspace->buf || !workspace->cbuf)
                goto fail;
 
index 8acb05e176c540460dc5acd4e25ea6609a0f86bc..6c231a116a29cbebbbc5691a2035a24f611746d9 100644 (file)
@@ -63,7 +63,7 @@ struct list_head *zlib_alloc_workspace(unsigned int level)
 
        workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
                        zlib_inflate_workspacesize());
-       workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL);
+       workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL | __GFP_NOWARN);
        workspace->level = level;
        workspace->buf = NULL;
        /*
index f798da267590d4c1ade2df464008cc39595c3587..e7ac4ec809a447a7dc1a1a3018a592b155177bc8 100644 (file)
@@ -356,7 +356,7 @@ struct list_head *zstd_alloc_workspace(unsigned int level)
        workspace->level = level;
        workspace->req_level = level;
        workspace->last_used = jiffies;
-       workspace->mem = kvmalloc(workspace->size, GFP_KERNEL);
+       workspace->mem = kvmalloc(workspace->size, GFP_KERNEL | __GFP_NOWARN);
        workspace->buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
        if (!workspace->mem || !workspace->buf)
                goto fail;