Re: 2.2.0 wishlist

Stephen C. Tweedie (sct@dcs.ed.ac.uk)
Sat, 15 Jun 1996 11:58:59 +0100


Hi,

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

> 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 ...
>>
>> Impossible. DMA *needs* contiguous memory ...

> 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).

As I said in the post, I think this is the wrong approach.
get_free_pages() is performance-critical and we should avoid bloating
it with code like this. There may also be places where we WANT to
fail rather than retry.

A better solution would be to add a second wrapper function around
get_free_pages which tries to get the dma-able memory and which takes
appropriate action if that fails. There are a lot of clever things
you might want to try, such as reshuffling cache pages rather than
just swapping out, in order to minimise the impact of the procedure.
In any case, what we really want to do is to identify what memory we
want to use, lock it down, and free it, rather than just speculatively
freeing anything until a contiguous free region magically appears.

Cheers,
Stephen.

--
Stephen Tweedie <sct@dcs.ed.ac.uk>
Department of Computer Science, Edinburgh University, Scotland.