diff options
author | Eric Dumazet <edumazet@google.com> | 2012-10-19 20:40:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-21 22:21:27 -0400 |
commit | 46baac38ef633b08168d27df7b02eb14578fb760 (patch) | |
tree | 978bf4b5f300062716c956af2d77a20d3912f3d1 /net/sched | |
parent | 47c1b7b95e747d216510dc2f29358b2f649cb58b (diff) |
pkt_sched: use ns_to_ktime() helper
ns_to_ktime() seems better than ktime_set() + ktime_add_ns()
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_api.c | 9 | ||||
-rw-r--r-- | net/sched/sch_cbq.c | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index a18d975db59..13cc744a249 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -495,16 +495,15 @@ EXPORT_SYMBOL(qdisc_watchdog_init); | |||
495 | 495 | ||
496 | void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, psched_time_t expires) | 496 | void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, psched_time_t expires) |
497 | { | 497 | { |
498 | ktime_t time; | ||
499 | |||
500 | if (test_bit(__QDISC_STATE_DEACTIVATED, | 498 | if (test_bit(__QDISC_STATE_DEACTIVATED, |
501 | &qdisc_root_sleeping(wd->qdisc)->state)) | 499 | &qdisc_root_sleeping(wd->qdisc)->state)) |
502 | return; | 500 | return; |
503 | 501 | ||
504 | qdisc_throttled(wd->qdisc); | 502 | qdisc_throttled(wd->qdisc); |
505 | time = ktime_set(0, 0); | 503 | |
506 | time = ktime_add_ns(time, PSCHED_TICKS2NS(expires)); | 504 | hrtimer_start(&wd->timer, |
507 | hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS); | 505 | ns_to_ktime(PSCHED_TICKS2NS(expires)), |
506 | HRTIMER_MODE_ABS); | ||
508 | } | 507 | } |
509 | EXPORT_SYMBOL(qdisc_watchdog_schedule); | 508 | EXPORT_SYMBOL(qdisc_watchdog_schedule); |
510 | 509 | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 564b9fc8efd..0e19948470b 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -509,8 +509,7 @@ static void cbq_ovl_delay(struct cbq_class *cl) | |||
509 | cl->cpriority = TC_CBQ_MAXPRIO; | 509 | cl->cpriority = TC_CBQ_MAXPRIO; |
510 | q->pmask |= (1<<TC_CBQ_MAXPRIO); | 510 | q->pmask |= (1<<TC_CBQ_MAXPRIO); |
511 | 511 | ||
512 | expires = ktime_set(0, 0); | 512 | expires = ns_to_ktime(PSCHED_TICKS2NS(sched)); |
513 | expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); | ||
514 | if (hrtimer_try_to_cancel(&q->delay_timer) && | 513 | if (hrtimer_try_to_cancel(&q->delay_timer) && |
515 | ktime_to_ns(ktime_sub( | 514 | ktime_to_ns(ktime_sub( |
516 | hrtimer_get_expires(&q->delay_timer), | 515 | hrtimer_get_expires(&q->delay_timer), |