linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* New net features for added performance
@ 2001-02-24 23:25 Jeff Garzik
  2001-02-24 23:48 ` Andi Kleen
                   ` (9 more replies)
  0 siblings, 10 replies; 37+ messages in thread
From: Jeff Garzik @ 2001-02-24 23:25 UTC (permalink / raw)
  To: netdev; +Cc: Linux Knernel Mailing List

Disclaimer:  This is 2.5, repeat, 2.5 material.



I've talked about the following items with a couple people on this list
in private.  I wanted to bring these up again, to see if anyone has
comments on the following suggested netdevice changes for the upcoming
2.5 development series of kernels.


1) Rx Skb recycling.  It would be nice to have skbs returned to the
driver after the net core is done with them, rather than have netif_rx
free the skb.  Many drivers pre-allocate a number of maximum-sized skbs
into which the net card DMA's data.  If netif_rx returned the SKB
instead of freeing it, the driver could simply flip the DescriptorOwned
bit for that buffer, giving it immediately back to the net card.

Advantages:  A de-allocation immediately followed by a reallocation is
eliminated, less L1 cache pollution during interrupt handling. 
Potentially less DMA traffic between card and host.

Disadvantages?



2) Tx packet grouping.  If the net core has knowledge that more packets
will be following the current one being sent to dev->hard_start_xmit(),
it should pass that knowledge on to dev->hard_start_xmit(), either as an
estimated number yet-to-be-sent, or just as a flag that "more is
coming."

Advantages: This lets the net driver make smarter decisions about Tx
interrupt mitigation, Tx buffer queueing, etc.

Disadvantages?  Can this sort of knowledge be obtained by a netdevice
right now, without any kernel modifications?



3) Slabbier packet allocation.  Even though skb allocation is decently
fast, you are still looking at an skb buffer head grab and a kmalloc,
for each [dev_]alloc_skb call.  I was wondering if it would be possible
to create a helper function for drivers which would improve the hot-path
considerably:

	static struct skbuff *ether_alloc_skb (int size)
	{
		if (size >= preallocated_skb_list->skb->size) {
			dequeue_skb_from_list()
			if (preallocate_size < low_water_limit)
				schedule_tasklet(refill_skb_list);
			return skb;
		}
		return dev_alloc_skb(size);
	}

The skbs from this list would be allocated by a tasklet in the
background to the maximum size requested by the ethernet driver.  If you
wanted to waste even more memory, you could allocate from per-CPU
lists..

Disadvantages?  Doing this might increase cache pollution due to
increased code and data size, but I think the hot path is much improved
(dequeue a properly sized, initialized, skb-reserved'd skb off a list)
and would help mitigate the impact of sudden bursts of traffic.



-- 
Jeff Garzik       | "You see, in this world there's two kinds of
Building 1024     |  people, my friend: Those with loaded guns
MandrakeSoft      |  and those who dig. You dig."  --Blondie

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

end of thread, other threads:[~2001-03-12 15:10 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-24 23:25 New net features for added performance Jeff Garzik
2001-02-24 23:48 ` Andi Kleen
2001-02-25  0:03   ` Jeff Garzik
2001-02-25  0:12     ` Andi Kleen
2000-01-01  0:19       ` Pavel Machek
2001-03-04  1:19         ` LILO error with 2.4.3-pre1 Steven J. Hill
2001-03-04  1:39           ` Keith Owens
2001-03-04  2:27             ` Tom Sightler
2001-03-04 21:32             ` Mircea Damian
2001-03-04 23:05               ` Guest section DW
2001-03-04  2:39           ` Andre Tomt
2001-03-04  3:32             ` Steven J. Hill
2001-03-04 13:35           ` Alan Cox
2001-02-25  0:13     ` New net features for added performance Jeff Garzik
2001-02-25  0:16       ` Andi Kleen
2001-02-25 11:49   ` Rusty Russell
2001-02-25  1:55 ` Michael Richardson
2001-02-25  2:32 ` Jeremy Jackson
2001-02-25  3:23   ` Chris Wedgwood
2001-02-25 12:41     ` Werner Almesberger
2001-02-25 13:57       ` Chris Wedgwood
2001-02-25  2:38 ` Noah Romer
2001-03-03 23:32   ` Jes Sorensen
2001-02-25 12:01 ` Andrew Morton
2001-02-25 15:11   ` Jeremy Jackson
2001-02-25 12:22 ` Werner Almesberger
2001-03-12 15:08   ` Jes Sorensen
2001-02-25 13:08 ` Jonathan Morton
2001-02-26 23:46 ` David S. Miller
2001-02-27  0:07   ` Jeff Garzik
2001-02-27  0:10   ` David S. Miller
2001-02-26 23:48 ` David S. Miller
2001-02-27  0:03   ` Andi Kleen
2001-02-27 19:59     ` kuznet
2001-02-27  0:08   ` David S. Miller
2001-02-27  2:53     ` Jeremy Jackson
2001-03-01 21:06 ` Jes Sorensen

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).