Re: Special handling for DMA memory?

Jon Tombs (jon@gte.esi.us.es)
Tue, 5 Mar 1996 17:34:04 +0100 (MET)


Matthias Sattler said:
>
> Detected scsi tape st0 at scsi0, channel 0, id 3, lun 0
> st: Can't allocate new tape buffer (nbr 0).
> Can't continue without at least one tape buffer.
>
> There is enough memory free, but no DMA memory (especially if the memory
> is requested GFP_ATOMIC). Similar things happen with the floppy module as
> well.
>
> I suggest a pool of reserved DMA memory that is only used if the memory is
> requested GFP_DMA and the request would fail otherwise. Maybe its size
> should be set via a kernel parameter.

The bug is in the get_free_page code, if there is enought free memory, then it
will return the memory or NULL. In the case of GFP_DMA, it shouldn't return
NULL without first trying to swap. We need to either fix this, or modify the
scsi tape module to play silly buggers allocating and freeing memory until
you create the dma buffer you need.

Summary: get_free_pages does normally swap in order to satisfy requests, but
it will stop swapping when there is enought free ram even if it is not
suitable for DMA (fragmented or beyond the DMA limit). I think get_free_pages
should only ever return NULL when called GFP_ATOMIC (this fix is simple to
change the if condition).

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