lkml.org 
[lkml]   [2010]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] mm: generic adaptive large memory allocation APIs
Date
Hi

> void *kvmalloc(size_t size)
> {
> void *ptr;
>
> if (size < PAGE_SIZE)
> return kmalloc(PAGE_SIZE, GFP_KERNEL);
> ptr = alloc_pages_exact(size, GFP_KERNEL | __GFP_NOWARN);

low order GFP_KERNEL allocation never fail. then, this doesn't works
as you expected.

> if (ptr != NULL)
> return ptr;
>
> return vmalloc(size);

On x86, vmalloc area is only 128MB address space. it is very rare
resource than physical ram. vmalloc fallback is not good idea.




\
 
 \ /
  Last update: 2010-05-13 06:47    [W:0.084 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site