lkml.org 
[lkml]   [2015]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree()
On (11/08/15 14:04), Tetsuo Handa wrote:
[..]
> Also, we might want to add a helper that does vmalloc() when
> kmalloc() failed because locations that do
>
> ptr = kmalloc(size, GFP_NOFS);
> if (!ptr)
> ptr = vmalloc(size); /* Wrong because GFP_KERNEL is used implicitly */
>
> are found.


ext4 does something like that.


void *ext4_kvmalloc(size_t size, gfp_t flags)
{
void *ret;

ret = kmalloc(size, flags | __GFP_NOWARN);
if (!ret)
ret = __vmalloc(size, flags, PAGE_KERNEL);
return ret;
}

-ss


\
 
 \ /
  Last update: 2015-11-08 06:41    [W:0.648 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site