Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: move sk->sk_err_soft and sk->sk_sndbuf

sk->sk_sndbuf is read-mostly in tx path, so move it from
sock_write_tx group to more appropriate sock_read_tx.

sk->sk_err_soft was not identified previously, but
is used from tcp_ack().

Move it to sock_write_tx group for better cache locality.

Also change tcp_ack() to clear sk->sk_err_soft only if needed.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250919204856.2977245-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
9303c3ce 17b14d23

+6 -4
+2 -2
include/net/sock.h
··· 467 467 __cacheline_group_begin(sock_write_tx); 468 468 int sk_write_pending; 469 469 atomic_t sk_omem_alloc; 470 - int sk_sndbuf; 470 + int sk_err_soft; 471 471 472 472 int sk_wmem_queued; 473 473 refcount_t sk_wmem_alloc; ··· 507 507 unsigned int sk_gso_max_size; 508 508 gfp_t sk_allocation; 509 509 u32 sk_txhash; 510 + int sk_sndbuf; 510 511 u8 sk_pacing_shift; 511 512 bool sk_use_task_frag; 512 513 __cacheline_group_end(sock_read_tx); ··· 524 523 unsigned long sk_lingertime; 525 524 struct proto *sk_prot_creator; 526 525 rwlock_t sk_callback_lock; 527 - int sk_err_soft; 528 526 u32 sk_ack_backlog; 529 527 u32 sk_max_ack_backlog; 530 528 unsigned long sk_ino;
+2 -1
net/core/sock.c
··· 4452 4452 4453 4453 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_write_tx, sk_omem_alloc); 4454 4454 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_write_tx, sk_omem_alloc); 4455 - CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_write_tx, sk_sndbuf); 4455 + CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_write_tx, sk_err_soft); 4456 4456 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_write_tx, sk_wmem_queued); 4457 4457 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_write_tx, sk_wmem_alloc); 4458 4458 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_write_tx, sk_tsq_flags); ··· 4479 4479 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_read_tx, sk_gso_max_size); 4480 4480 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_read_tx, sk_allocation); 4481 4481 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_read_tx, sk_txhash); 4482 + CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_read_tx, sk_sndbuf); 4482 4483 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_read_tx, sk_gso_max_segs); 4483 4484 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_read_tx, sk_pacing_shift); 4484 4485 CACHELINE_ASSERT_GROUP_MEMBER(struct sock, sock_read_tx, sk_use_task_frag);
+2 -1
net/ipv4/tcp_input.c
··· 4085 4085 /* We passed data and got it acked, remove any soft error 4086 4086 * log. Something worked... 4087 4087 */ 4088 - WRITE_ONCE(sk->sk_err_soft, 0); 4088 + if (READ_ONCE(sk->sk_err_soft)) 4089 + WRITE_ONCE(sk->sk_err_soft, 0); 4089 4090 WRITE_ONCE(icsk->icsk_probes_out, 0); 4090 4091 tp->rcv_tstamp = tcp_jiffies32; 4091 4092 if (!prior_packets)