Messages in this thread | | | Date | Sun, 8 Nov 2015 14:30:44 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [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
| |