[OpenAFS-devel] How can the mem cache possibly not be able to allocate memory?

Pete Zaitcev zaitcev@redhat.com
Mon, 12 Apr 2004 18:16:59 -0700


On Mon, 12 Apr 2004 20:58:40 -0400
"chas williams (contractor)" <chas@cmf.nrl.navy.mil> wrote:

> a little more about vmalloc/kmalloc in openafs.  i re-instrumented the
> linux memory allocator (for a different reason) but it turns out to 
> be useful here as well.  here are any allocations > 64k
>[...]
> its pretty clear some of these could not be allocated with kmalloc().

It is a well known fact that kmalloc on Linux cannot allocate
anything bigger than order 1 (on 2.4) or order 2 (on 2.6),
most of the time. Allocations for order 2 can sleep for a long time,
so better not to count on them anyway. No kernel exists which
performed any sort of coalescing, so high order allocations always
fail after any sort of uptime.

This is why vmalloc was invented in the first place. Its original
purpose was to place module text.

So, for any Linux kernel hacker, a code which does kmalloc, if that
fails falls back to vmalloc is a red flag. They have entirely different
characteristics. For one thing, DMA is not possible into vmalloc-ed
memory...

-- Pete