lkml.org 
[lkml]   [2009]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 3/3] net: use HRTIMER_RESTART in sched_cbq
Restarting a hrtimer from the callback function via hrtimer_start is
inefficient. The canonical way is to modify the expiry value of the
timer and return HRTIMER_RESTART to the hrtimer core code which takes
care of the restart.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
net/sched/sch_cbq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6/net/sched/sch_cbq.c
===================================================================
--- linux-2.6.orig/net/sched/sch_cbq.c
+++ linux-2.6/net/sched/sch_cbq.c
@@ -605,6 +605,7 @@ static enum hrtimer_restart cbq_undelay(
struct cbq_sched_data *q = container_of(timer, struct cbq_sched_data,
delay_timer);
struct Qdisc *sch = q->watchdog.qdisc;
+ enum hrtimer_restart ret = HRTIMER_NORESTART;
psched_time_t now;
psched_tdiff_t delay = 0;
unsigned pmask;
@@ -634,13 +635,14 @@ static enum hrtimer_restart cbq_undelay(

time = ktime_set(0, 0);
time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay));
- hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS);
+ hrtimer_set_expires(&q->delay_timer, time);
+ ret = HRTIMER_RESTART;
}
spin_unlock(&q->lock);

sch->flags &= ~TCQ_F_THROTTLED;
__netif_schedule(qdisc_root(sch));
- return HRTIMER_NORESTART;
+ return ret;
}

#ifdef CONFIG_NET_CLS_ACT



\
 
 \ /
  Last update: 2009-07-10 00:05    [W:1.803 / U:0.312 seconds]
©2003-2014 Jasper Spaans. Advertise on this site