Re: memory

Jon Tombs (jon@gte.esi.us.es)
Thu, 14 Mar 1996 17:21:19 +0100 (MET)


Albert Cahalan said:
>
> Please check this:

Ok

> ****** Getting memory
>
> get_free_pages()
> max 128 kB
iff there there exists such a block currently free

> physically one piece

> OK for DMA
If called with GFP_DMA, (__get_dma_pages())

> can not be freed
Freed with free_pages()

> usable only at boot

Usable almost any time. With the restrictions:

GFP_BUFFER requests will swap in order to return free memory.

GFP_ATOMIC will return NULL if there isn't
enough free contiguous memory.

GFP_DMA will return NULL if there is
enough free memory but it isn't contiguos, or below the DMA limit. It
will swap otherwise (but may still return NULL if the above condition
is met first).

> can only allocate a multiple of the page size (4kB or 8kB)
Can only allocate powers of 2 of pages size (on x86, 4k 8k 16k 32k ... 128k)

> kmalloc()
> max 128kB - headersize (waste: adds headersize, rounds up to some 2^n)
> physically one piece
> OK for DMA
Ok for dma if called with GFP_DMA.

> free with kfree()
> usable anytime (pass parameter to indicate if IRQ handler)
> can allocate tiny fragments (small ones are wasteful)

-- 
Jon. <jon@gte.esi.us.es, http://www.esi.us.es/~jon>