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
..
2011-03-31 11:26:23 -03:00
2011-08-13 01:10:16 -07:00
2011-07-26 16:49:47 -07:00
2011-05-05 11:10:14 -07:00
2010-06-03 03:21:52 -07:00
2009-03-21 19:06:54 -07:00
2010-10-27 11:37:32 -07:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-07-26 16:49:47 -07:00
2011-07-17 23:11:35 -07:00
2010-10-25 13:09:45 -07:00
2011-11-09 16:36:27 -05:00
2008-06-11 21:00:38 -07:00
2010-10-27 11:37:32 -07:00
2011-03-31 11:26:23 -03:00
2011-09-16 19:20:20 -04:00
2011-07-26 16:49:47 -07:00
2010-06-03 03:21:52 -07:00
2011-07-26 16:49:47 -07:00
2011-07-26 16:49:47 -07:00
2009-01-06 11:38:15 -07:00
2011-05-17 14:16:58 -04:00
2011-01-24 15:32:47 -08:00
2009-03-21 19:06:50 -07:00
2011-11-08 17:07:07 -05:00
2008-07-05 21:25:39 -07:00
2009-10-07 16:39:43 -04:00
2011-03-31 11:26:23 -03:00
2010-11-28 11:12:20 -08:00