I'm using linux kernel version 2.6.24 for an embedded system. For a hardware device I need to provide many large physically contiguous allocations ( typically around 32kb to 1mb per allocation). The size and number are dynamically variable and it is acceptable to define an upper limit for the total size of the allocations.

Until now I have been using a reserved part of the memory completely dedicated for this device. This works well except the reserved memory is not unusable for other purposes when all or part of it is not in use.

Now I'm trying to evaluate if I can use kmalloc (or maybe get_free_pages??) to allocate the physically contiguous allocations. I'm having trouble trying to find out how easily kmalloc will be able to find physically contiguous pages given that the system is already running with lots of applications for some time. This probably depends on the specific applications and device drivers used, but I'd like to get a feel for this.

What I'm concerned with is does linux kernel take any care that the amount of physically contiguous memory is maximized (i.e. minimizing fragmentation of free pages) If the kernel tries to allocate within the large ranges of free physical pages only at the lowest priority, I could probably say that there is a good chance a kmalloc call will not fail due to fragmentation.

Any information on this? Anyway I can control the kernel priority on this? Where else can I find more information.

Thanks a lot!