kernel-hacking-2024-linux-s.../net/core
Eric Dumazet 93f154b594 net: release dst entry in dev_hard_start_xmit()
One point of contention in high network loads is the dst_release() performed
when a transmited skb is freed. This is because NIC tx completion calls
dev_kree_skb() long after original call to dev_queue_xmit(skb).

CPU cache is cold and the atomic op in dst_release() stalls. On SMP, this is
quite visible if one CPU is 100% handling softirqs for a network device,
since dst_clone() is done by other cpus, involving cache line ping pongs.

It seems right place to release dst is in dev_hard_start_xmit(), for most
devices but ones that are virtual, and some exceptions.

David Miller suggested to define a new device flag, set in alloc_netdev_mq()
(so that most devices set it at init time), and carefuly unset in devices
which dont want a NULL skb->dst in their ndo_start_xmit().

List of devices that must clear this flag is :

- loopback device, because it calls netif_rx() and quoting Patrick :
    "ip_route_input() doesn't accept loopback addresses, so loopback packets
     already need to have a dst_entry attached."
- appletalk/ipddp.c : needs skb->dst in its xmit function

- And all devices that call again dev_queue_xmit() from their xmit function
(as some classifiers need skb->dst) : bonding, vlan, macvlan, eql, ifb, hdlc_fr

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-05-18 22:19:19 -07:00
..
datagram.c Network Drop Monitor: Fix skb_kill_datagram 2009-05-08 14:57:01 -07:00
dev.c net: release dst entry in dev_hard_start_xmit() 2009-05-18 22:19:19 -07:00
dev_mcast.c
drop_monitor.c drop_monitor: Update netlink protocol to include netlink attribute header in alert message 2009-04-27 03:17:31 -07:00
dst.c
ethtool.c core: remove pointless conditional before kfree() 2009-03-31 15:06:26 -07:00
fib_rules.c ipv4: remove an unused parameter from configure method of fib_rules_ops. 2009-05-17 11:59:45 -07:00
filter.c
flow.c
gen_estimator.c pkt_sched: gen_estimator: use 64 bit intermediate counters for bps 2009-05-18 19:26:37 -07:00
gen_stats.c
iovec.c tun: fix tun_chr_aio_write so that aio works 2009-04-21 05:42:46 -07:00
kmap_skb.h
link_watch.c
Makefile Network Drop Monitor: Adding Build changes to enable drop monitor 2009-03-13 12:09:29 -07:00
neighbour.c
net-sysfs.c net-sysfs: Use rtnl_trylock in sysfs methods. 2009-05-18 22:15:57 -07:00
net-sysfs.h
net-traces.c Network Drop Monitor: Add trace declaration for skb frees 2009-03-13 12:09:27 -07:00
net_namespace.c netns 2/2: extract net_create() 2009-05-04 11:12:14 -07:00
netevent.c
netpoll.c netpoll: don't dereference NULL dev from np 2009-05-17 20:37:55 -07:00
pktgen.c proc 2/2: remove struct proc_dir_entry::owner 2009-03-31 01:14:44 +04:00
request_sock.c
rtnetlink.c
scm.c
skb_dma_map.c
skbuff.c net: update skb_recycle_check() for hardware timestamping changes 2009-05-06 16:49:18 -07:00
sock.c epoll keyed wakeups: make sockets use keyed wakeups 2009-04-01 08:59:20 -07:00
stream.c tcp: tcp_prequeue() can use keyed wakeups 2009-05-17 20:44:43 -07:00
sysctl_net_core.c
user_dma.c
utils.c net: core: remove unneeded include in net/core/utils.c. 2009-03-26 01:11:48 -07:00