lkml.org 
[lkml]   [2010]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] fs: use kmalloc() to allocate fdmem if possible
From
Date
Le lundi 03 mai 2010 à 11:19 +0200, Jiri Slaby a écrit :
> On 05/03/2010 11:13 AM, Eric Dumazet wrote:
> > /*
> > * Warning: if size is not a power of two, kmalloc() might
> > * waste memory because of its requirements.
> > */
> > void *kvmalloc(size_t size)
> > {
> > void *ptr = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
>
> This is kind of waste of high-order pages, isn't it? Wouldn't it be
> better to have a watermark where we skip kmalloc completely?

>
>

There are many drawbacks using kmalloc() instead of vmalloc().

(NUMA comes to mind, if you want a zone spreaded on all available nodes)

So this kvmalloc() is not meant to be a generic replacement of all
vmalloc() users, only selected ones.

In some spots, allocating 8192 bytes in a driver setup for example, it
should be fine. Using a high order page for this is perfect, as long as
we can have a fallback to vmalloc()

grep bnx2_alloc_mem /proc/vmallocinfo
0xf8690000-0xf8692000 8192 bnx2_alloc_mem+0x111/0x6d0 pages=1 vmalloc


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-05-03 11:31    [W:0.043 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site