Re: 2.2.0 wishlist

Jon Tombs (jon@gte.esi.us.es)
Sat, 15 Jun 1996 00:51:15 +0200 (MET DST)


Stephen Tweedie said:

> > * Allocate ftape DMA buffers (96KB!) on first open (free on last
> > close) instead of during driver initialization; needs fixing
> > the memory allocation code first so that it doesn't cause so
> > much fragmentation (and failing to allocate large contiguous
> > areas even though there are still lots of free pages)
>
> Impossible. DMA *needs* contiguous memory, and how you allocate
> memory is largely irrelevant --- you simply don't have control over
> how the application will access that memory, so you can't control
> which order pages get freed int. Any method which can guarantee large
> contiguous requests is going waste as much memory as the DMA buffers
> would be occupying themselves.

DMA is a pretty special case, and not that common, as open/insmod is not time
critical, get free pages just needs to swap pages until the dma buffer is
available. I once hacked get_free_pages to do this (currently it returns NULL
if called with the ATOMIC flag, or if there is enough ram free, but not
suitable for DMA (i.e. fragmented or above the DMA_LIMIT). I simply changed
the if to only return NULL for the atomic case. This is far from optimal, as
it would free a single dmable page each loop, with no intelligence with regard
to contiguous, but it allowed ftape to always get its 96K buffer within a few
seconds, and the needlessly swaped out pages soon return...

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