linux/net
Eric Dumazet d826eb14ec ipv4: PKTINFO doesnt need dst reference
Le lundi 07 novembre 2011 à 15:33 +0100, Eric Dumazet a écrit :

> At least, in recent kernels we dont change dst->refcnt in forwarding
> patch (usinf NOREF skb->dst)
>
> One particular point is the atomic_inc(dst->refcnt) we have to perform
> when queuing an UDP packet if socket asked PKTINFO stuff (for example a
> typical DNS server has to setup this option)
>
> I have one patch somewhere that stores the information in skb->cb[] and
> avoid the atomic_{inc|dec}(dst->refcnt).
>

OK I found it, I did some extra tests and believe its ready.

[PATCH net-next] ipv4: IP_PKTINFO doesnt need dst reference

When a socket uses IP_PKTINFO notifications, we currently force a dst
reference for each received skb. Reader has to access dst to get needed
information (rt_iif & rt_spec_dst) and must release dst reference.

We also forced a dst reference if skb was put in socket backlog, even
without IP_PKTINFO handling. This happens under stress/load.

We can instead store the needed information in skb->cb[], so that only
softirq handler really access dst, improving cache hit ratios.

This removes two atomic operations per packet, and false sharing as
well.

On a benchmark using a mono threaded receiver (doing only recvmsg()
calls), I can reach 720.000 pps instead of 570.000 pps.

IP_PKTINFO is typically used by DNS servers, and any multihomed aware
UDP application.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-11-09 16:36:27 -05:00
..
9p
802
8021q Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
appletalk
atm
ax25
batman-adv
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2011-11-07 10:55:33 -08:00
bridge Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
caif
can
ceph
core net: rename sk_clone to sk_clone_lock 2011-11-08 17:07:07 -05:00
dcb
dccp net: rename sk_clone to sk_clone_lock 2011-11-08 17:07:07 -05:00
decnet
dns_resolver
dsa
econet
ethernet
ieee802154
ipv4 ipv4: PKTINFO doesnt need dst reference 2011-11-09 16:36:27 -05:00
ipv6 ipv4: PKTINFO doesnt need dst reference 2011-11-09 16:36:27 -05:00
ipx
irda
iucv
key
l2tp l2tp: fix l2tp_udp_recv_core() 2011-11-08 13:59:44 -05:00
lapb
llc
mac80211 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2011-11-07 10:55:33 -08:00
netfilter Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
netlabel
netlink
netrom
nfc Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
packet af_packet: de-inline some helper functions 2011-11-03 18:11:51 -04:00
phonet
rds Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
rfkill
rose
rxrpc
sched sch_choke: use skb_header_pointer() 2011-11-08 16:41:31 -05:00
sctp sctp: fasthandoff with ASCONF at server-node 2011-11-08 15:11:30 -05:00
sunrpc Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
tipc
unix
wanrouter wanrouter: Remove kernel_lock annotations 2011-11-07 13:27:30 -05:00
wimax
wireless
x25 Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
xfrm
compat.c
Kconfig
Makefile
nonet.c
socket.c
sysctl_net.c