* [PATCH net-next] net_sched: sch_fq: avoid calling ktime_get_ns() if not needed
@ 2018-11-20 1:30 Eric Dumazet
2018-11-20 17:58 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2018-11-20 1:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet
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>
---
net/sched/sch_fq.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index 1da8864502d448cfa93a9c02da504af61a1093e5..1a662f2bb7bb7bb5507107f61657d44fa28ca991 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -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;
--
2.19.1.1215.g8438c0b245-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] net_sched: sch_fq: avoid calling ktime_get_ns() if not needed
2018-11-20 1:30 [PATCH net-next] net_sched: sch_fq: avoid calling ktime_get_ns() if not needed Eric Dumazet
@ 2018-11-20 17:58 ` David Miller
2018-11-20 17:59 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2018-11-20 17:58 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 19 Nov 2018 17:30:19 -0800
> 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>
Applied.
But just to be clear, if the qdisc is empty we do not need to update
flow credits etc.?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net_sched: sch_fq: avoid calling ktime_get_ns() if not needed
2018-11-20 17:58 ` David Miller
@ 2018-11-20 17:59 ` Eric Dumazet
0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2018-11-20 17:59 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Eric Dumazet
On Tue, Nov 20, 2018 at 9:58 AM David Miller <davem@davemloft.net> wrote:
>
> From: Eric Dumazet <edumazet@google.com>
> Date: Mon, 19 Nov 2018 17:30:19 -0800
>
> > 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>
>
> Applied.
>
> But just to be clear, if the qdisc is empty we do not need to update
> flow credits etc.?
That is right, nothing needs to be done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-21 4:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-20 1:30 [PATCH net-next] net_sched: sch_fq: avoid calling ktime_get_ns() if not needed Eric Dumazet
2018-11-20 17:58 ` David Miller
2018-11-20 17:59 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox