Skip to content

Commit

Permalink
net_sched: sch_fq: avoid calling ktime_get_ns() if not needed
Browse files Browse the repository at this point in the history
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: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 20, 2018
1 parent 6133e78 commit 6b015a5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/sched/sch_fq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct fq_sched_data *q = qdisc_priv(sch);
u64 now = ktime_get_ns();
struct fq_flow_head *head;
struct sk_buff *skb;
struct fq_flow *f;
unsigned long rate;
u32 plen;
u64 now;

if (!sch->q.qlen)
return NULL;

skb = fq_dequeue_head(sch, &q->internal);
if (skb)
goto out;

now = ktime_get_ns();
fq_check_throttled(q, now);
begin:
head = &q->new_flows;
Expand Down

0 comments on commit 6b015a5

Please sign in to comment.