lkml.org 
[lkml]   [2013]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] btrfs: use kmalloc for lzo de/compress buffer
On Mon, Feb 18, 2013 at 04:56:04PM +0900, Kyungsik Lee wrote:
> @@ -55,8 +55,9 @@ static struct list_head *lzo_alloc_workspace(void)
> return ERR_PTR(-ENOMEM);
>
> workspace->mem = vmalloc(LZO1X_MEM_COMPRESS);
> - workspace->buf = vmalloc(PAGE_CACHE_SIZE);
> - workspace->cbuf = vmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE));
> + workspace->buf = kmalloc(PAGE_CACHE_SIZE, GFP_NOFS);
> + workspace->cbuf = kmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE),

This is still larger than usual page size and allocator may issue a
warning, so if we want to use kmalloc (it's ~4.4k in size and likely to
be available, but not always due to possible page fragmentation), the
__GFP_NOWARN should be supplied and if the allocation fails fall back to
vmalloc.

david


\
 
 \ /
  Last update: 2013-02-21 15:21    [W:0.045 / U:0.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site