Re: Memory allocation of 132 KB

Jeanette Pauline Middelink (middelin@polyware.nl)
Fri, 2 Oct 1998 01:04:21 +0200


On Tue, Sep 29, 1998 at 12:32:15PM +0200, Andrea Arcangeli wrote:
> On Tue, 29 Sep 1998 sroy@wipinfo.soft.net wrote:
>
> >Hi,
> >
> >In a network driver, I tried to allocate memory for DMA buffer of length
> >132 KB and the call (kmalloc()) failed. Hacking through kmalloc.c, I found
> >that it does not allow allocating memory more than (128K - 24) bytes, if the
> >page size is 4KB.
> >
> >Me questions are -
> >
> >1. Why is that limitation ?
> >2. Is there any way to allocate 132 KB memory (physically contiguous) ?
>
> Use __get_free_pages() by hand specifying the order or mm you need. order
> 0 -> 1 page, order 2 -> 2page, order 3 -> 4 page etc..etc..

One of the reasons Linux still does not support big kmalloc's is
due to the fact of memory fragmentation. This is still happening
and due to this, the changes of getting a large block of kmemory
are getting lower and lower the longer the kernel runs...

So your advice on using __get_free_pages is a bit of a kludge
because the next thing he'll be asking is why the kmalloc
suddenly start to fail when he still got many times the requested
amount free...

Met vriendelijke groet,
Pauline Middelink

-- 
PGP Key fingerprint = DE 6B D0 D9 19 AD A7 A0  58 A3 06 9D B6 34 39 E2
For more details look at my website http://www.polyware.nl/~middelin

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