Commit 38acce2d7983632100a9ff3fd20295f6e34074a8

Authored by David S. Miller
1 parent ee5f9757ea

pkt_sched: Convert CBQ to tasklet_hrtimer.

This code expects to run in softirq context, and bare hrtimers
run in hw IRQ context.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Thomas Gleixner <tglx@linutronix.de>

Showing 1 changed file with 13 additions and 10 deletions Side-by-side Diff

... ... @@ -163,7 +163,7 @@
163 163 psched_time_t now_rt; /* Cached real time */
164 164 unsigned pmask;
165 165  
166   - struct hrtimer delay_timer;
  166 + struct tasklet_hrtimer delay_timer;
167 167 struct qdisc_watchdog watchdog; /* Watchdog timer,
168 168 started when CBQ has
169 169 backlog, but cannot
... ... @@ -503,6 +503,8 @@
503 503 cl->undertime = q->now + delay;
504 504  
505 505 if (delay > 0) {
  506 + struct hrtimer *ht;
  507 +
506 508 sched += delay + cl->penalty;
507 509 cl->penalized = sched;
508 510 cl->cpriority = TC_CBQ_MAXPRIO;
... ... @@ -510,12 +512,12 @@
510 512  
511 513 expires = ktime_set(0, 0);
512 514 expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched));
513   - if (hrtimer_try_to_cancel(&q->delay_timer) &&
514   - ktime_to_ns(ktime_sub(
515   - hrtimer_get_expires(&q->delay_timer),
516   - expires)) > 0)
517   - hrtimer_set_expires(&q->delay_timer, expires);
518   - hrtimer_restart(&q->delay_timer);
  515 + ht = &q->delay_timer.timer;
  516 + if (hrtimer_try_to_cancel(ht) &&
  517 + ktime_to_ns(ktime_sub(hrtimer_get_expires(ht),
  518 + expires)) > 0)
  519 + hrtimer_set_expires(ht, expires);
  520 + hrtimer_restart(ht);
519 521 cl->delayed = 1;
520 522 cl->xstats.overactions++;
521 523 return;
... ... @@ -621,7 +623,7 @@
621 623  
622 624 time = ktime_set(0, 0);
623 625 time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay));
624   - hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS);
  626 + tasklet_hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS);
625 627 }
626 628  
627 629 sch->flags &= ~TCQ_F_THROTTLED;
... ... @@ -1214,7 +1216,7 @@
1214 1216 q->tx_class = NULL;
1215 1217 q->tx_borrowed = NULL;
1216 1218 qdisc_watchdog_cancel(&q->watchdog);
1217   - hrtimer_cancel(&q->delay_timer);
  1219 + tasklet_hrtimer_cancel(&q->delay_timer);
1218 1220 q->toplevel = TC_CBQ_MAXLEVEL;
1219 1221 q->now = psched_get_time();
1220 1222 q->now_rt = q->now;
... ... @@ -1397,7 +1399,8 @@
1397 1399 q->link.minidle = -0x7FFFFFFF;
1398 1400  
1399 1401 qdisc_watchdog_init(&q->watchdog, sch);
1400   - hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
  1402 + tasklet_hrtimer_init(&q->delay_timer, cbq_undelay,
  1403 + CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
1401 1404 q->delay_timer.function = cbq_undelay;
1402 1405 q->toplevel = TC_CBQ_MAXLEVEL;
1403 1406 q->now = psched_get_time();