DMA memory allocation problems + patch

Francis Devereux (f.devereux@cs.ucl.ac.uk)
Wed, 26 Aug 1998 15:45:19 +0100


Hi,

In kernels 2.1.11[357] I have had problems playing sounds after loading
large applications (e.g. X, netscape) due to problems allocating DMA
buffers. I have an ISA SB AWE64 and 64M of RAM.

I made the following changes to page_alloc.c which causes memory to be
allocated from the top of RAM first, hopefully leaving enough free
memory under 16M for DMA buffers. It does work for me, however I
can see that it won't always solve the problem. What I think needs to
happen is that when there isn't any RAM for DMA buffers some space
should be made by moving pages from under 16M to above 16M or paging
them out, however I don't know enough about the kernel to implement
this myself.

Francis

--- linux-2.1.117/mm.old/page_alloc.c Tue Aug 25 19:00:59 1998
+++ linux-2.1.117/mm/page_alloc.c Wed Aug 26 12:20:40 1998
@@ -200,19 +200,19 @@
#define RMQUEUE(order, dma) \
do { struct free_area_struct * area = free_area+order; \
unsigned long new_order = order; \
- do { struct page *prev = memory_head(area), *ret = prev->next; \
+ do { struct page *next = memory_head(area), *ret = next->prev; \
while (memory_head(area) != ret) { \
if (!dma || CAN_DMA(ret)) { \
unsigned long map_nr = ret->map_nr; \
- (prev->next = ret->next)->prev = prev; \
+ (next->prev = ret->prev)->next = next; \
MARK_USED(map_nr, new_order, area); \
nr_free_pages -= 1 << order; \
EXPAND(ret, map_nr, order, new_order, area); \
spin_unlock_irqrestore(&page_alloc_lock, flags); \
return ADDRESS(map_nr); \
} \
- prev = ret; \
- ret = ret->next; \
+ next = ret; \
+ ret = ret->prev; \
} \
new_order++; area++; \
} while (new_order < NR_MEM_LISTS); \

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html