netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch 12/16 2.5] ixgb: replace kmalloc with vmalloc to allocate driver local data structures
@ 2004-10-15 13:55 Ganesh Venkatesan
  2004-10-15 16:46 ` Christian Borntraeger
  0 siblings, 1 reply; 3+ messages in thread
From: Ganesh Venkatesan @ 2004-10-15 13:55 UTC (permalink / raw)
  To: jgarzik@pobox.com; +Cc: netdev

diff -up net-drivers-2.6/drivers/net/ixgb/ixgb.h net-drivers-2.6/drivers/net/ixgb.new/ixgb.h
--- net-drivers-2.6/drivers/net/ixgb/ixgb.h	2004-10-05 15:50:18.000000000 -0700
+++ net-drivers-2.6/drivers/net/ixgb.new/ixgb.h	2004-10-05 16:03:24.000000000 -0700
@@ -46,10 +46,10 @@
 #include <linux/delay.h>
 #include <linux/timer.h>
 #include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <linux/interrupt.h>
 #include <linux/string.h>
 #include <linux/pagemap.h>
-#include <linux/dma-mapping.h>
 #include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/irq.h>
diff -up net-drivers-2.6/drivers/net/ixgb/ixgb_main.c net-drivers-2.6/drivers/net/ixgb.new/ixgb_main.c
--- net-drivers-2.6/drivers/net/ixgb/ixgb_main.c	2004-10-05 15:50:18.000000000 -0700
+++ net-drivers-2.6/drivers/net/ixgb.new/ixgb_main.c	2004-10-05 17:55:48.000000000 -0700
@@ -609,8 +609,8 @@ static int ixgb_close(struct net_device 
 	int size;
 
 	size = sizeof(struct ixgb_buffer) * txdr->count;
-	txdr->buffer_info = kmalloc(size, GFP_KERNEL);
-	if (!txdr->buffer_info) {
+	txdr->buffer_info = vmalloc(size);
+	if(!txdr->buffer_info) {
 		return -ENOMEM;
 	}
 	memset(txdr->buffer_info, 0, size);
@@ -621,8 +620,8 @@ static int ixgb_setup_tx_resources(struc
 	IXGB_ROUNDUP(txdr->size, 4096);
 
 	txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
-	if (!txdr->desc) {
-		kfree(txdr->buffer_info);
+	if(!txdr->desc) {
+		vfree(txdr->buffer_info);
 		return -ENOMEM;
 	}
 	memset(txdr->desc, 0, txdr->size);
@@ -698,8 +692,8 @@ static void ixgb_configure_tx(struct ixg
 	int size;
 
 	size = sizeof(struct ixgb_buffer) * rxdr->count;
-	rxdr->buffer_info = kmalloc(size, GFP_KERNEL);
-	if (!rxdr->buffer_info) {
+	rxdr->buffer_info = vmalloc(size);
+	if(!rxdr->buffer_info) {
 		return -ENOMEM;
 	}
 	memset(rxdr->buffer_info, 0, size);
@@ -711,8 +713,8 @@ static int ixgb_setup_rx_resources(struc
 
 	rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
 
-	if (!rxdr->desc) {
-		kfree(rxdr->buffer_info);
+	if(!rxdr->desc) {
+		vfree(rxdr->buffer_info);
 		return -ENOMEM;
 	}
 	memset(rxdr->desc, 0, rxdr->size);
@@ -866,7 +867,7 @@ static void ixgb_configure_rx(struct ixg
 
 	ixgb_clean_tx_ring(adapter);
 
-	kfree(adapter->tx_ring.buffer_info);
+	vfree(adapter->tx_ring.buffer_info);
 	adapter->tx_ring.buffer_info = NULL;
 
 	pci_free_consistent(pdev, adapter->tx_ring.size,
@@ -932,7 +935,7 @@ static void ixgb_clean_tx_ring(struct ix
 
 	ixgb_clean_rx_ring(adapter);
 
-	kfree(rx_ring->buffer_info);
+	vfree(rx_ring->buffer_info);
 	rx_ring->buffer_info = NULL;
 
 	pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch 12/16 2.5] ixgb: replace kmalloc with vmalloc to allocate driver local data structures
  2004-10-15 13:55 [Patch 12/16 2.5] ixgb: replace kmalloc with vmalloc to allocate driver local data structures Ganesh Venkatesan
@ 2004-10-15 16:46 ` Christian Borntraeger
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Borntraeger @ 2004-10-15 16:46 UTC (permalink / raw)
  To: Ganesh Venkatesan; +Cc: jgarzik@pobox.com, netdev

Ganesh Venkatesan wrote:
> - rxdr->buffer_info = kmalloc(size, GFP_KERNEL);
[...]
> + rxdr->buffer_info = vmalloc(size);

What is the rationale for this change?

If I recall correctly, Linus opposes the use of vmalloc if there is no real 
need.

cheers

Christian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Patch 12/16 2.5] ixgb: replace kmalloc with vmalloc to allocate driver local data structures
@ 2004-10-15 20:10 Venkatesan, Ganesh
  0 siblings, 0 replies; 3+ messages in thread
From: Venkatesan, Ganesh @ 2004-10-15 20:10 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: jgarzik, netdev

Kmalloc resources are more scarce than vmalloc. In this case, there are
systems where allocation of [rt]xdr->buffer_info fails when the
descriptor ring sizes are set to the maximum allowable value (4096) and
kmalloc is used. Using vmalloc solves this issue.

Ganesh.

-----Original Message-----
From: Christian Borntraeger [mailto:linux-kernel@borntraeger.net] 
Sent: Friday, October 15, 2004 9:47 AM
To: Venkatesan, Ganesh
Cc: jgarzik@pobox.com; netdev
Subject: Re: [Patch 12/16 2.5] ixgb: replace kmalloc with vmalloc to
allocate driver local data structures

Ganesh Venkatesan wrote:
> - rxdr->buffer_info = kmalloc(size, GFP_KERNEL);
[...]
> + rxdr->buffer_info = vmalloc(size);

What is the rationale for this change?

If I recall correctly, Linus opposes the use of vmalloc if there is no
real 
need.

cheers

Christian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-15 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-15 13:55 [Patch 12/16 2.5] ixgb: replace kmalloc with vmalloc to allocate driver local data structures Ganesh Venkatesan
2004-10-15 16:46 ` Christian Borntraeger
  -- strict thread matches above, loose matches on Subject: below --
2004-10-15 20:10 Venkatesan, Ganesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).