diff options
author | Eric Dumazet <edumazet@google.com> | 2020-03-17 05:12:50 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-18 07:16:35 +0300 |
commit | b88948fbc7cec03bd97fe5be65264681e98041e8 (patch) | |
tree | 351e2b1165849c97cc6b2974e713f3b00c3f0447 /net/sched/sch_api.c | |
parent | efe074c2cc1c67021481f56ba87cc61d1ab03e33 (diff) | |
download | linux-b88948fbc7cec03bd97fe5be65264681e98041e8.tar.xz |
net_sched: do not reprogram a timer about to expire
qdisc_watchdog_schedule_range_ns() can use the newly added slack
and avoid rearming the hrtimer a bit earlier than the current
value. This patch has no effect if delta_ns parameter
is zero.
Note that this means the max slack is potentially doubled.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r-- | net/sched/sch_api.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 83984be04f57..0d99df1e764d 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -625,8 +625,13 @@ void qdisc_watchdog_schedule_range_ns(struct qdisc_watchdog *wd, u64 expires, &qdisc_root_sleeping(wd->qdisc)->state)) return; - if (wd->last_expires == expires) - return; + if (hrtimer_is_queued(&wd->timer)) { + /* If timer is already set in [expires, expires + delta_ns], + * do not reprogram it. + */ + if (wd->last_expires - expires <= delta_ns) + return; + } wd->last_expires = expires; hrtimer_start_range_ns(&wd->timer, |