Commit 38acce2d authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent ee5f9757
...@@ -163,7 +163,7 @@ struct cbq_sched_data ...@@ -163,7 +163,7 @@ struct cbq_sched_data
psched_time_t now_rt; /* Cached real time */ psched_time_t now_rt; /* Cached real time */
unsigned pmask; unsigned pmask;
struct hrtimer delay_timer; struct tasklet_hrtimer delay_timer;
struct qdisc_watchdog watchdog; /* Watchdog timer, struct qdisc_watchdog watchdog; /* Watchdog timer,
started when CBQ has started when CBQ has
backlog, but cannot backlog, but cannot
...@@ -503,6 +503,8 @@ static void cbq_ovl_delay(struct cbq_class *cl) ...@@ -503,6 +503,8 @@ static void cbq_ovl_delay(struct cbq_class *cl)
cl->undertime = q->now + delay; cl->undertime = q->now + delay;
if (delay > 0) { if (delay > 0) {
struct hrtimer *ht;
sched += delay + cl->penalty; sched += delay + cl->penalty;
cl->penalized = sched; cl->penalized = sched;
cl->cpriority = TC_CBQ_MAXPRIO; cl->cpriority = TC_CBQ_MAXPRIO;
...@@ -510,12 +512,12 @@ static void cbq_ovl_delay(struct cbq_class *cl) ...@@ -510,12 +512,12 @@ static void cbq_ovl_delay(struct cbq_class *cl)
expires = ktime_set(0, 0); expires = ktime_set(0, 0);
expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched));
if (hrtimer_try_to_cancel(&q->delay_timer) && ht = &q->delay_timer.timer;
ktime_to_ns(ktime_sub( if (hrtimer_try_to_cancel(ht) &&
hrtimer_get_expires(&q->delay_timer), ktime_to_ns(ktime_sub(hrtimer_get_expires(ht),
expires)) > 0) expires)) > 0)
hrtimer_set_expires(&q->delay_timer, expires); hrtimer_set_expires(ht, expires);
hrtimer_restart(&q->delay_timer); hrtimer_restart(ht);
cl->delayed = 1; cl->delayed = 1;
cl->xstats.overactions++; cl->xstats.overactions++;
return; return;
...@@ -621,7 +623,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) ...@@ -621,7 +623,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
time = ktime_set(0, 0); time = ktime_set(0, 0);
time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay)); time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay));
hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS); tasklet_hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS);
} }
sch->flags &= ~TCQ_F_THROTTLED; sch->flags &= ~TCQ_F_THROTTLED;
...@@ -1214,7 +1216,7 @@ cbq_reset(struct Qdisc* sch) ...@@ -1214,7 +1216,7 @@ cbq_reset(struct Qdisc* sch)
q->tx_class = NULL; q->tx_class = NULL;
q->tx_borrowed = NULL; q->tx_borrowed = NULL;
qdisc_watchdog_cancel(&q->watchdog); qdisc_watchdog_cancel(&q->watchdog);
hrtimer_cancel(&q->delay_timer); tasklet_hrtimer_cancel(&q->delay_timer);
q->toplevel = TC_CBQ_MAXLEVEL; q->toplevel = TC_CBQ_MAXLEVEL;
q->now = psched_get_time(); q->now = psched_get_time();
q->now_rt = q->now; q->now_rt = q->now;
...@@ -1397,7 +1399,8 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -1397,7 +1399,8 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
q->link.minidle = -0x7FFFFFFF; q->link.minidle = -0x7FFFFFFF;
qdisc_watchdog_init(&q->watchdog, sch); qdisc_watchdog_init(&q->watchdog, sch);
hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); tasklet_hrtimer_init(&q->delay_timer, cbq_undelay,
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
q->delay_timer.function = cbq_undelay; q->delay_timer.function = cbq_undelay;
q->toplevel = TC_CBQ_MAXLEVEL; q->toplevel = TC_CBQ_MAXLEVEL;
q->now = psched_get_time(); q->now = psched_get_time();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment