Re: [12/14] vcompound: Avoid vmalloc in e1000 driver

Previous thread: [07/14] vcompound: bit waitqueue support by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (1 message)

Next thread: [11/14] vcompound: Fallbacks for order 1 stack allocations on IA64 and x86 by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (52 messages)
To: <linux-mm@...>
Cc: <linux-kernel@...>
Date: Friday, March 21, 2008 - 2:17 am

Switch all the uses of vmalloc in the e1000 driver to virtual compounds.
This will result in the use of regular memory for the ring buffers etc
avoiding page tables,

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
drivers/net/e1000/e1000_main.c | 23 +++++++++++------------
drivers/net/e1000e/netdev.c | 12 ++++++------
2 files changed, 17 insertions(+), 18 deletions(-)

Index: linux-2.6.25-rc5-mm1/drivers/net/e1000e/netdev.c
===================================================================
--- linux-2.6.25-rc5-mm1.orig/drivers/net/e1000e/netdev.c 2008-03-20 21:52:45.962733927 -0700
+++ linux-2.6.25-rc5-mm1/drivers/net/e1000e/netdev.c 2008-03-20 21:57:27.212078371 -0700
@@ -1083,7 +1083,7 @@ int e1000e_setup_tx_resources(struct e10
int err = -ENOMEM, size;

size = sizeof(struct e1000_buffer) * tx_ring->count;
- tx_ring->buffer_info = vmalloc(size);
+ tx_ring->buffer_info = __alloc_vcompound(GFP_KERNEL, get_order(size));
if (!tx_ring->buffer_info)
goto err;
memset(tx_ring->buffer_info, 0, size);
@@ -1102,7 +1102,7 @@ int e1000e_setup_tx_resources(struct e10

return 0;
err:
- vfree(tx_ring->buffer_info);
+ __free_vcompound(tx_ring->buffer_info);
ndev_err(adapter->netdev,
"Unable to allocate memory for the transmit descriptor ring\n");
return err;
@@ -1121,7 +1121,7 @@ int e1000e_setup_rx_resources(struct e10
int i, size, desc_len, err = -ENOMEM;

size = sizeof(struct e1000_buffer) * rx_ring->count;
- rx_ring->buffer_info = vmalloc(size);
+ rx_ring->buffer_info = __alloc_vcompound(GFP_KERNEL, get_order(size));
if (!rx_ring->buffer_info)
goto err;
memset(rx_ring->buffer_info, 0, size);
@@ -1157,7 +1157,7 @@ err_pages:
kfree(buffer_info->ps_pages);
}
err:
- vfree(rx_ring->buffer_info);
+ __free_vcompound(rx_ring->buffer_info);
ndev_err(adapter->netdev,
"Unable to allocate memory for the transmit descriptor ring\n");
return err;
@@ -1204,7 +1204,7 ...

To: Christoph Lameter <clameter@...>
Cc: <linux-mm@...>, <linux-kernel@...>
Date: Friday, March 21, 2008 - 1:27 pm

hey, cool patch for sure!

I'll see if I can transpose this to e1000e and all the other drivers I maintain
which use vmalloc as well.

This one goes on my queue and I'll merge through Jeff.

Thanks Christoph!

--

Previous thread: [07/14] vcompound: bit waitqueue support by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (1 message)

Next thread: [11/14] vcompound: Fallbacks for order 1 stack allocations on IA64 and x86 by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (52 messages)