Skip to content

Commit 7ba0537

Browse files
edumazetdavem330
authored andcommitted
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: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dde0a64 commit 7ba0537

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/sched/sch_fq.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static inline struct fq_skb_cb *fq_skb_cb(struct sk_buff *skb)
6666
* in linear list (head,tail), otherwise are placed in a rbtree (t_root).
6767
*/
6868
struct fq_flow {
69+
/* First cache line : used in fq_gc(), fq_enqueue(), fq_dequeue() */
6970
struct rb_root t_root;
7071
struct sk_buff *head; /* list of skbs for this flow : first skb */
7172
union {
@@ -74,14 +75,18 @@ struct fq_flow {
7475
};
7576
struct rb_node fq_node; /* anchor in fq_root[] trees */
7677
struct sock *sk;
78+
u32 socket_hash; /* sk_hash */
7779
int qlen; /* number of packets in flow queue */
80+
81+
/* Second cache line, used in fq_dequeue() */
7882
int credit;
79-
u32 socket_hash; /* sk_hash */
83+
/* 32bit hole on 64bit arches */
84+
8085
struct fq_flow *next; /* next pointer in RR lists */
8186

8287
struct rb_node rate_node; /* anchor in q->delayed tree */
8388
u64 time_next_packet;
84-
};
89+
} ____cacheline_aligned_in_smp;
8590

8691
struct fq_flow_head {
8792
struct fq_flow *first;

0 commit comments

Comments
 (0)