Re: kmalloc

David S. Miller (davem@dm.cobaltmicro.com)
Mon, 25 Jan 1999 14:08:21 -0800


Date: Mon, 25 Jan 1999 22:49:58 +0200 (EET)
From: Matti Aarnio <matti.aarnio@sonera.fi>

I think we will be needing GFP_DMA32 soon.
(And it will cause *massive* amounts of changes as practically all
drivers will need touching...)

DaveM can tell us how the large SPARC64 systems do it with their heaps
of busses and address spaces.

"Massive"? It's very simple to make it work:

1) Set include/asm/scatterlist.h:ISA_DMA_THRESHOLD and
include/asm/dma.h:MAX_DMA_ADDRESS appropriately for your
architecture.

2) For all SCSI drivers just have them set host->unchecked_isa_dma to 1

3) For all networking drivers, have them use GFP_DMA when allocating
receive buffers and in the transmit code do something like:

if ((unsigned long)(skb->data + skb->len) >= MAX_DMA_ADDRESS) {
struct sk_buff *new_skb = skb_copy(skb, GFP_DMA | GFP_ATOMIC);
if (!new_skb)
return 1;
dev_kfree_skb(skb);
skb = new_skb;
}

Voila... and it works, tested on a 5GB memory machine....

Later,
David S. Miller
davem@dm.cobaltmicro.com

-
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.tux.org/lkml/