Re: Bugs and wishes in memory management area

Albert Cahalan (albert@ccs.neu.edu)
Fri, 22 Nov 1996 20:17:24 -0500 (EST)


From: Gerard Roudier <groudier@club-internet.fr>
> On Fri, 22 Nov 1996, Jean Francois Martinez wrote:
>>> From: Gerard Roudier <groudier@club-internet.fr>
>>>
>>> 4) Suggestions:
>>> A suggestion, for > 16MB systems is to garbage if necessary
>>> up to 1MB in a pool for ISA/DMA but to keep the kernel simple.
>>> Kernel modules/drivers that allocate ISA/DMA memory when it
>>> is not needed are to be reworked (or rewritten).
>>
>> Interesting idea. But there are still boxes with less than 16 Meg.
>> Ah the good old days where Linux was usable with 2 megs and was
>> advertised as being as being small and mean.
>
> At work, we use Linux/X/GNU as development system (about 15 linux
> stations). 2 megs is probably just enough to load the kernel and
> kernel is not pageable.

If the machine has enough memory, the kernel should be loaded at
the 16 MB mark.

> Now imagine a system with 128 MB of RAM and some controller(s)
> that use(s) ISA/DMA and:
> - Some processes have locked memory.
> - Some IOs are being processed. Corresponding memory is locked.
>
> (Locked memory CANNOT be swapped).

Could locked memory be moved? The kernel could find something above
the 16 MB ISA DMA limit, swap that, then move the locked memory up
there. The locked memory does not get swapped, only moved.

If not, the memory can be moved as the application locks it.
Whenever mlock is called, the memory gets moved above the 16 MB
mark before it is actually locked.

> Imagine now that one load a module that requests
> (rightly or wronly) ISA/DMAable memory and:
> - Unfortunately locked pages just preclude this allocation.
>
> Managing such situation may complexify the kernel too much.
> In this case, garbaging 1 MB of memory at startup for ISA/DMA
> need is probably a good solution.
>
> On the other hand, being given that 128/16=8, 87% IOs will need
> to be double-buffered. Doing DMA in that conditions is in my
> opinion pretty stupid.

Why double buffer? If the DMA memory allocation is modified to
move pages around, the kernel can just put everything below the
16 MB limit. I guess you could call this delayed double buffering.
The advantage is that sometimes the copy can be avoided. It would
be previous allocations that get the copy. There is a chance that
some previous allocation will be freed, and there is a chance that
some previous allocation will be ready to discard or swap out.