diff options
author | Eric Dumazet <edumazet@google.com> | 2020-05-02 19:54:20 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-05-03 15:50:31 -0700 |
commit | 82a0aa53b520edf50e08bad347d87d898de414eb (patch) | |
tree | b1a1c4df10c691a5a3c23fa0864aeb819cdc9e90 /net/sched/sch_fq.c | |
parent | 7ba0537c2b534149be288f851900b4cf5aacde48 (diff) | |
download | linux-82a0aa53b520edf50e08bad347d87d898de414eb.tar.gz linux-82a0aa53b520edf50e08bad347d87d898de414eb.tar.bz2 linux-82a0aa53b520edf50e08bad347d87d898de414eb.zip |
net_sched: sch_fq: use bulk freeing in fq_gc()
fq_gc() already builds a small array of pointers, so using
kmem_cache_free_bulk() needs very little change.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_fq.c')
-rw-r--r-- | net/sched/sch_fq.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index ced1f987d7e4..53ec47ff8469 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c @@ -214,9 +214,10 @@ static void fq_gc(struct fq_sched_data *q, struct rb_root *root, struct sock *sk) { - struct fq_flow *f, *tofree[FQ_GC_MAX]; struct rb_node **p, *parent; - int fcnt = 0; + void *tofree[FQ_GC_MAX]; + struct fq_flow *f; + int i, fcnt = 0; p = &root->rb_node; parent = NULL; @@ -239,15 +240,18 @@ static void fq_gc(struct fq_sched_data *q, p = &parent->rb_left; } + if (!fcnt) + return; + + for (i = fcnt; i > 0; ) { + f = tofree[--i]; + rb_erase(&f->fq_node, root); + } q->flows -= fcnt; q->inactive_flows -= fcnt; q->stat_gc_flows += fcnt; - while (fcnt) { - struct fq_flow *f = tofree[--fcnt]; - rb_erase(&f->fq_node, root); - kmem_cache_free(fq_flow_cachep, f); - } + kmem_cache_free_bulk(fq_flow_cachep, fcnt, tofree); } static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q) |