the cost of vmalloc
mulyadi.santosa at gmail.com
Sat Sep 10 02:53:10 EDT 2011
On Sat, Sep 10, 2011 at 08:16, Zheng Da <zhengda1936 at gmail.com> wrote:
> I need to allocate fairly a large piece of memory, about 128KB or
128 K? Are you sure? That doesn't sound too big for me...but I might
be wrong here..... if you say 4 megabyte, now that's big...
>I tried to use kmalloc, and it sometimes fails, but vmalloc in
> this case usually still work.
easy to guess, vmalloc doesn't care if it's not physically
contigous...only virtually contigous
> 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
invalidating page table, at some point yes. Also searching non
physically contigous could be hard too. But again, this is your last
resort to gain such a large memory area.
just my 2 cents idea...
Freelance Linux trainer and consultant
More information about the Kernelnewbies