Skip to contentSkip to conversation

Hi.... I guess linux-kernel..

DISCUSSION Dan Maas 1 participant 1 message Sep 25, 2001 1 message not in the archive

lore
Share & tools
lore

Dan Maas

author
#1 lore raw
In reply to a message not in the archive
Quoted 3 lines

I want to know, how use continuous memory over 128k at linux kernel... kmalloc is 128k limit...
But, I want continous memory over 128k at linux kernel...

kmalloc() returns physically contiguous regions of memory. The 128KB limit exists because it is difficult to find a free memory block that large in a running system, due to fragmentation.

You have two options - if you can use a virtually (but not physically) contiguous region of memory, use vmalloc(). This works fine for kernel data structures. If you are using the memory as a DMA buffer however, you need to be aware that the pages are not physically contiguous, so you have to DMA each page individually (scatter/gather). Also for DMA to 32-bit PCI devices, use vmalloc_32() instead of vmalloc() (which might give you high-memory pages that are inaccessible to 32-bit devices).

The second option is to grab a large physically-contiguous region of memory at boot time. There are a few kernel patches available that provide this feature, although I haven't used them. For a really quick hack, you can use the "mem=xxxM" boot-time option to tell the kernel to use less physical memory than you actually have, and then claim the remaining memory for your own use.

Regards,
Dan