History

tcp: move sk_mark_napi_id() at the right place

sk_mark_napi_id() is used to record for a flow napi id of incoming packets for busypoll sake. We should do this only on established flows, not on listeners. This was 'working' by virtue of the socket cloning, but doing this on SYN packets in unecessary cache line dirtying. Even if we move sk_napi_id in the same cache line than sk_lock, we are working to make SYN processing lockless, so it is desirable to set sk_napi_id only for established flows.

Eric Dumazet committed 12 years ago

Commit 3d973791 parent 2e1af7d2 files · +4 −2Browse files

Unified · Split

2 files
  1. net/ipv4/tcp_ipv4.c +2 −1
  2. net/ipv6/tcp_ipv6.c +2 −1
net/ipv4/tcp_ipv4.c+2−1
@@ -1429,6 +1429,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) · 1428 unmodified lines
14291429 struct dst_entry *dst = sk->sk_rx_dst;
14301430
14311431 sock_rps_save_rxhash(sk, skb);
1432+ sk_mark_napi_id(sk, skb);
14321433 if (dst) {
14331434 if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
14341435 dst->ops->check(dst, 0) == NULL) {
@@ -1450,6 +1451,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) · 15 unmodified lines
14501451
14511452 if (nsk != sk) {
14521453 sock_rps_save_rxhash(nsk, skb);
1454+ sk_mark_napi_id(sk, skb);
14531455 if (tcp_child_process(sk, nsk, skb)) {
14541456 rsk = nsk;
14551457 goto reset;
@@ -1661,7 +1663,6 @@ process: · 205 unmodified lines
16611663 if (sk_filter(sk, skb))
16621664 goto discard_and_relse;
16631665
1664− sk_mark_napi_id(sk, skb);
16651666 skb->dev = NULL;
16661667
16671668 bh_lock_sock_nested(sk);
net/ipv6/tcp_ipv6.c+2−1
@@ -1293,6 +1293,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) · 1292 unmodified lines
12931293 struct dst_entry *dst = sk->sk_rx_dst;
12941294
12951295 sock_rps_save_rxhash(sk, skb);
1296+ sk_mark_napi_id(sk, skb);
12961297 if (dst) {
12971298 if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
12981299 dst->ops->check(dst, np->rx_dst_cookie) == NULL) {
@@ -1322,6 +1323,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) · 23 unmodified lines
13221323 */
13231324 if (nsk != sk) {
13241325 sock_rps_save_rxhash(nsk, skb);
1326+ sk_mark_napi_id(sk, skb);
13251327 if (tcp_child_process(sk, nsk, skb))
13261328 goto reset;
13271329 if (opt_skb)
@@ -1454,7 +1456,6 @@ process: · 126 unmodified lines
14541456 if (sk_filter(sk, skb))
14551457 goto discard_and_relse;
14561458
1457− sk_mark_napi_id(sk, skb);
14581459 skb->dev = NULL;
14591460
14601461 bh_lock_sock_nested(sk);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t