Commit 6b015a52 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net_sched: sch_fq: avoid calling ktime_get_ns() if not needed

There are two cases were we can avoid calling ktime_get_ns() :

1) Queue is empty.
2) Internal queue is not empty.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6133e78f
...@@ -414,16 +414,21 @@ static void fq_check_throttled(struct fq_sched_data *q, u64 now) ...@@ -414,16 +414,21 @@ static void fq_check_throttled(struct fq_sched_data *q, u64 now)
static struct sk_buff *fq_dequeue(struct Qdisc *sch) static struct sk_buff *fq_dequeue(struct Qdisc *sch)
{ {
struct fq_sched_data *q = qdisc_priv(sch); struct fq_sched_data *q = qdisc_priv(sch);
u64 now = ktime_get_ns();
struct fq_flow_head *head; struct fq_flow_head *head;
struct sk_buff *skb; struct sk_buff *skb;
struct fq_flow *f; struct fq_flow *f;
unsigned long rate; unsigned long rate;
u32 plen; u32 plen;
u64 now;
if (!sch->q.qlen)
return NULL;
skb = fq_dequeue_head(sch, &q->internal); skb = fq_dequeue_head(sch, &q->internal);
if (skb) if (skb)
goto out; goto out;
now = ktime_get_ns();
fq_check_throttled(q, now); fq_check_throttled(q, now);
begin: begin:
head = &q->new_flows; head = &q->new_flows;
......
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