Commit 7ba0537c authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net_sched: sch_fq: change fq_flow size/layout

sizeof(struct fq_flow) is 112 bytes on 64bit arches.

This means that half of them use two cache lines, but 50% use
three cache lines.

This patch adds cache line alignment, and makes sure that only
the first cache line is touched by fq_enqueue(), which is more
expensive that fq_dequeue() in general.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dde0a648
...@@ -66,6 +66,7 @@ static inline struct fq_skb_cb *fq_skb_cb(struct sk_buff *skb) ...@@ -66,6 +66,7 @@ static inline struct fq_skb_cb *fq_skb_cb(struct sk_buff *skb)
* in linear list (head,tail), otherwise are placed in a rbtree (t_root). * in linear list (head,tail), otherwise are placed in a rbtree (t_root).
*/ */
struct fq_flow { struct fq_flow {
/* First cache line : used in fq_gc(), fq_enqueue(), fq_dequeue() */
struct rb_root t_root; struct rb_root t_root;
struct sk_buff *head; /* list of skbs for this flow : first skb */ struct sk_buff *head; /* list of skbs for this flow : first skb */
union { union {
...@@ -74,14 +75,18 @@ struct fq_flow { ...@@ -74,14 +75,18 @@ struct fq_flow {
}; };
struct rb_node fq_node; /* anchor in fq_root[] trees */ struct rb_node fq_node; /* anchor in fq_root[] trees */
struct sock *sk; struct sock *sk;
u32 socket_hash; /* sk_hash */
int qlen; /* number of packets in flow queue */ int qlen; /* number of packets in flow queue */
/* Second cache line, used in fq_dequeue() */
int credit; int credit;
u32 socket_hash; /* sk_hash */ /* 32bit hole on 64bit arches */
struct fq_flow *next; /* next pointer in RR lists */ struct fq_flow *next; /* next pointer in RR lists */
struct rb_node rate_node; /* anchor in q->delayed tree */ struct rb_node rate_node; /* anchor in q->delayed tree */
u64 time_next_packet; u64 time_next_packet;
}; } ____cacheline_aligned_in_smp;
struct fq_flow_head { struct fq_flow_head {
struct fq_flow *first; struct fq_flow *first;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment