Re: Hi.... I guess linux-kernel..

Dan Maas (dmaas@dcine.com)
Tue, 25 Sep 2001 07:18:12 -0400


> 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/