Hi :) On Sat, Sep 10, 2011 at 08:16, Zheng Da <zhengda1936@gmail.com> wrote:
Hello,
I need to allocate fairly a large piece of memory, about 128KB or 256KB.
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 suggestions?
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... -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com