net_sched: sch_fq: always garbage collect
authorEric Dumazet <edumazet@google.com>
Wed, 20 Sep 2023 20:17:15 +0000 (20:17 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Oct 2023 12:20:36 +0000 (13:20 +0100)
FQ performs garbage collection at enqueue time, and only
if number of flows is above a given threshold, which
is hit after the qdisc has been used a bit.

Since an RB-tree traversal is needed to locate a flow,
it makes sense to perform gc all the time, to keep
rb-trees smaller.

This reduces by 50 % average storage costs in FQ,
and avoids 1 cache line miss at enqueue time when
fast path added in prior patch can not be used.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_fq.c

index 5cf3b50a24d58d0e22c33997592696c4a03ec8ee..681bbf34b70763032c68d89003307ceec8ab46b4 100644 (file)
@@ -367,9 +367,7 @@ static struct fq_flow *fq_classify(struct Qdisc *sch, struct sk_buff *skb)
 
        root = &q->fq_root[hash_ptr(sk, q->fq_trees_log)];
 
-       if (q->flows >= (2U << q->fq_trees_log) &&
-           q->inactive_flows > q->flows/2)
-               fq_gc(q, root, sk);
+       fq_gc(q, root, sk);
 
        p = &root->rb_node;
        parent = NULL;