Skip to content

Commit 4cdb1e2

Browse files
Eric Dumazetdavem330
authored andcommitted
net: shrink struct softnet_data
flow_limit in struct softnet_data is only read from local cpu and can be moved to fill a hole, reducing softnet_data size by 64 bytes on x86_64 While we are at it, move output_queue, output_queue_tailp and completion_queue, so that rx / tx paths touch a single cache line. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 55b42b5 commit 4cdb1e2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

include/linux/netdevice.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,21 +2329,25 @@ extern int netdev_flow_limit_table_len;
23292329
* Incoming packets are placed on per-cpu queues
23302330
*/
23312331
struct softnet_data {
2332-
struct Qdisc *output_queue;
2333-
struct Qdisc **output_queue_tailp;
23342332
struct list_head poll_list;
2335-
struct sk_buff *completion_queue;
23362333
struct sk_buff_head process_queue;
23372334

23382335
/* stats */
23392336
unsigned int processed;
23402337
unsigned int time_squeeze;
23412338
unsigned int cpu_collision;
23422339
unsigned int received_rps;
2343-
23442340
#ifdef CONFIG_RPS
23452341
struct softnet_data *rps_ipi_list;
2342+
#endif
2343+
#ifdef CONFIG_NET_FLOW_LIMIT
2344+
struct sd_flow_limit __rcu *flow_limit;
2345+
#endif
2346+
struct Qdisc *output_queue;
2347+
struct Qdisc **output_queue_tailp;
2348+
struct sk_buff *completion_queue;
23462349

2350+
#ifdef CONFIG_RPS
23472351
/* Elements below can be accessed between CPUs for RPS */
23482352
struct call_single_data csd ____cacheline_aligned_in_smp;
23492353
struct softnet_data *rps_ipi_next;
@@ -2355,9 +2359,6 @@ struct softnet_data {
23552359
struct sk_buff_head input_pkt_queue;
23562360
struct napi_struct backlog;
23572361

2358-
#ifdef CONFIG_NET_FLOW_LIMIT
2359-
struct sd_flow_limit __rcu *flow_limit;
2360-
#endif
23612362
};
23622363

23632364
static inline void input_queue_head_incr(struct softnet_data *sd)

0 commit comments

Comments
 (0)