Skip to content

Commit bab091d

Browse files
committed
Merge branch 'net-misplaced-fields'
Eric Dumazet says: ==================== net: more three misplaced fields We recently reorganized some structures for better data locality in networking fast paths. This series moves three fields that were not correctly classified. There probably more to come. Reference : https://lwn.net/Articles/951321/ ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 78e563f + c353c7b commit bab091d

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

Documentation/networking/net_cachelines/net_device.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ struct_netpoll_info* npinfo -
136136
possible_net_t nd_net - read_mostly (dev_net)napi_busy_loop,tcp_v(4/6)_rcv,ip(v6)_rcv,ip(6)_input,ip(6)_input_finish
137137
void* ml_priv
138138
enum_netdev_ml_priv_type ml_priv_type
139-
struct_pcpu_lstats__percpu* lstats
140-
struct_pcpu_sw_netstats__percpu* tstats
139+
struct_pcpu_lstats__percpu* lstats read_mostly dev_lstats_add()
140+
struct_pcpu_sw_netstats__percpu* tstats read_mostly dev_sw_netstats_tx_add()
141141
struct_pcpu_dstats__percpu* dstats
142142
struct_garp_port* garp_port
143143
struct_mrp_port* mrp_port

Documentation/networking/net_cachelines/tcp_sock.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ u32 max_window read_mostly -
3838
u32 mss_cache read_mostly read_mostly tcp_rate_check_app_limited,tcp_current_mss,tcp_sync_mss,tcp_sndbuf_expand,tcp_tso_should_defer(tx);tcp_update_pacing_rate,tcp_clean_rtx_queue(rx)
3939
u32 window_clamp read_mostly read_write tcp_rcv_space_adjust,__tcp_select_window
4040
u32 rcv_ssthresh read_mostly - __tcp_select_window
41-
u82 scaling_ratio
41+
u8 scaling_ratio read_mostly read_mostly tcp_win_from_space
4242
struct tcp_rack
4343
u16 advmss - read_mostly tcp_rcv_space_adjust
4444
u8 compressed_ack
4545
u8:2 dup_ack_counter
4646
u8:1 tlp_retrans
47-
u8:1 tcp_usec_ts
47+
u8:1 tcp_usec_ts read_mostly read_mostly
4848
u32 chrono_start read_write - tcp_chrono_start/stop(tcp_write_xmit,tcp_cwnd_validate,tcp_send_syn_data)
4949
u32[3] chrono_stat read_write - tcp_chrono_start/stop(tcp_write_xmit,tcp_cwnd_validate,tcp_send_syn_data)
5050
u8:2 chrono_type read_write - tcp_chrono_start/stop(tcp_write_xmit,tcp_cwnd_validate,tcp_send_syn_data)

include/linux/netdevice.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,11 @@ struct net_device {
21412141

21422142
/* TXRX read-mostly hotpath */
21432143
__cacheline_group_begin(net_device_read_txrx);
2144+
union {
2145+
struct pcpu_lstats __percpu *lstats;
2146+
struct pcpu_sw_netstats __percpu *tstats;
2147+
struct pcpu_dstats __percpu *dstats;
2148+
};
21442149
unsigned int flags;
21452150
unsigned short hard_header_len;
21462151
netdev_features_t features;
@@ -2395,11 +2400,6 @@ struct net_device {
23952400
enum netdev_ml_priv_type ml_priv_type;
23962401

23972402
enum netdev_stat_type pcpu_stat_type:8;
2398-
union {
2399-
struct pcpu_lstats __percpu *lstats;
2400-
struct pcpu_sw_netstats __percpu *tstats;
2401-
struct pcpu_dstats __percpu *dstats;
2402-
};
24032403

24042404
#if IS_ENABLED(CONFIG_GARP)
24052405
struct garp_port __rcu *garp_port;

include/linux/tcp.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,10 @@ struct tcp_sock {
221221
u32 lost_out; /* Lost packets */
222222
u32 sacked_out; /* SACK'd packets */
223223
u16 tcp_header_len; /* Bytes of tcp header to send */
224+
u8 scaling_ratio; /* see tcp_win_from_space() */
224225
u8 chrono_type : 2, /* current chronograph type */
225226
repair : 1,
227+
tcp_usec_ts : 1, /* TSval values in usec */
226228
is_sack_reneg:1, /* in recovery from loss with SACK reneg? */
227229
is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
228230
__cacheline_group_end(tcp_sock_read_txrx);
@@ -352,7 +354,6 @@ struct tcp_sock {
352354
u32 compressed_ack_rcv_nxt;
353355
struct list_head tsq_node; /* anchor in tsq_tasklet.head list */
354356

355-
u8 scaling_ratio; /* see tcp_win_from_space() */
356357
/* Information of the most recently (s)acked skb */
357358
struct tcp_rack {
358359
u64 mstamp; /* (Re)sent time of the skb */
@@ -368,8 +369,7 @@ struct tcp_sock {
368369
u8 compressed_ack;
369370
u8 dup_ack_counter:2,
370371
tlp_retrans:1, /* TLP is a retransmission */
371-
tcp_usec_ts:1, /* TSval values in usec */
372-
unused:4;
372+
unused:5;
373373
u8 thin_lto : 1,/* Use linear timeouts for thin streams */
374374
recvmsg_inq : 1,/* Indicate # of bytes in queue upon recvmsg */
375375
fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */

net/core/dev.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -11652,11 +11652,12 @@ static void __init net_dev_struct_check(void)
1165211652
CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_tx, 160);
1165311653

1165411654
/* TXRX read-mostly hotpath */
11655+
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, lstats);
1165511656
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, flags);
1165611657
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, hard_header_len);
1165711658
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, features);
1165811659
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, ip6_ptr);
11659-
CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_txrx, 30);
11660+
CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_txrx, 38);
1166011661

1166111662
/* RX read-mostly hotpath */
1166211663
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_rx, ptype_specific);

net/ipv4/tcp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -4615,7 +4615,8 @@ static void __init tcp_struct_check(void)
46154615
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, prr_out);
46164616
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, lost_out);
46174617
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, sacked_out);
4618-
CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 31);
4618+
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, scaling_ratio);
4619+
CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 32);
46194620

46204621
/* RX read-mostly hotpath cache lines */
46214622
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, copied_seq);

0 commit comments

Comments
 (0)