the cost of vmalloc
michi1 at michaelblizek.twilightparadox.com
Sat Sep 10 03:35:52 EDT 2011
On 21:16 Fri 09 Sep , Zheng Da wrote:
> I need to allocate fairly a large piece of memory, about 128KB or
> 256KB. I tried to use kmalloc, and it sometimes fails, but vmalloc in
> this case usually still work.
> But I'm not sure how costly vmalloc is. As far as I know, vmalloc
> needs to change the page table, and thus might need to invalidate TLB.
> It seems quite expensive. If it is, maybe I can allocate memory with
> kmalloc first, and then try to use vmalloc if kmalloc fails. Any
If it is at all possible, I would suggest avoiding to allocate more than
PAGE_SIZE (usually 4KB) in one continuous chunk. You can use e.g.
scatterlists (which are basically lists of pointers) if you need a bigger
programing a layer 3+4 network protocol for mesh networks
More information about the Kernelnewbies