Commit 82a0aa53 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7ba0537c
...@@ -214,9 +214,10 @@ static void fq_gc(struct fq_sched_data *q, ...@@ -214,9 +214,10 @@ static void fq_gc(struct fq_sched_data *q,
struct rb_root *root, struct rb_root *root,
struct sock *sk) struct sock *sk)
{ {
struct fq_flow *f, *tofree[FQ_GC_MAX];
struct rb_node **p, *parent; 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; p = &root->rb_node;
parent = NULL; parent = NULL;
...@@ -239,15 +240,18 @@ static void fq_gc(struct fq_sched_data *q, ...@@ -239,15 +240,18 @@ static void fq_gc(struct fq_sched_data *q,
p = &parent->rb_left; 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->flows -= fcnt;
q->inactive_flows -= fcnt; q->inactive_flows -= fcnt;
q->stat_gc_flows += fcnt; q->stat_gc_flows += fcnt;
while (fcnt) {
struct fq_flow *f = tofree[--fcnt];
rb_erase(&f->fq_node, root); kmem_cache_free_bulk(fq_flow_cachep, fcnt, tofree);
kmem_cache_free(fq_flow_cachep, f);
}
} }
static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q) static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q)
......
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