From patchwork Thu Jul 9 21:59:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 29644 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id A99E2B708A for ; Fri, 10 Jul 2009 08:00:00 +1000 (EST) Received: by ozlabs.org (Postfix) id 9DEE7DDDF7; Fri, 10 Jul 2009 08:00:00 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 31671DDDF6 for ; Fri, 10 Jul 2009 08:00:00 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757266AbZGIV74 (ORCPT ); Thu, 9 Jul 2009 17:59:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757220AbZGIV7z (ORCPT ); Thu, 9 Jul 2009 17:59:55 -0400 Received: from www.tglx.de ([62.245.132.106]:37953 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757133AbZGIV7y (ORCPT ); Thu, 9 Jul 2009 17:59:54 -0400 Received: from localhost.localdomain (www.tglx.de [127.0.0.1]) by www.tglx.de (8.13.8/8.13.8/TGLX-2007100201) with ESMTP id n69LxZX0031473; Thu, 9 Jul 2009 23:59:35 +0200 Message-Id: <20090709215606.725707255@linutronix.de> User-Agent: quilt/0.47-1 Date: Thu, 09 Jul 2009 21:59:34 -0000 From: Thomas Gleixner To: netdev@vger.kernel.org Cc: LKML , David Miller , Patrick McHardy , Peter Zijlstra Subject: [patch 3/3] net: use HRTIMER_RESTART in sched_cbq References: <20090709215455.703939259@linutronix.de> Content-Disposition: inline; filename=net-sched-cbq-use-hrtimer-restart.patch X-Virus-Scanned: clamav-milter 0.95.1 at www.tglx.de X-Virus-Status: Clean X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,AWL autolearn=failed version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on www.tglx.de Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- net/sched/sch_cbq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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