From patchwork Fri Mar 28 11:41:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27259 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3F07C20062 for ; Fri, 28 Mar 2014 11:42:23 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id n16sf17533466oag.5 for ; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=SbXGtOBh5AVlOoPj3136QM6H0E3VMFxYWL0C+NqGszs=; b=N/cAHoP736rgcSWig1Yc3FMl0xngHtdGZUEEmVAXz5AzSbtI4AuhuSQIbn8n1tumSf 6hOACh7TkP6E3kt6lyAJ2CFCdrnEKnTPnP8ARBGKGgR5QfKBwrcxVv9GZZVUcrl6mbNM 9RZJvx/ED+nDukglZsDrId9iqnCTwnxA0oiycqqLzqZ9aB/c0IMxn+YiYe8HG3eJ+kwW YogFXrzBtOXudRSjUdxnoEPvr2lgi1OQZJVHwD04Qvnr5P/r0yvrpSmX4leQzb6YhBt2 0S/vcjXLjH9MoRRvc2hIq0O8qKsdV05IZ8r9FQZfe5golUrdMSreNIgGKP5+YuF9HcIt AERA== X-Gm-Message-State: ALoCoQlxB2Uinubr5BvmZptpB2xIWgD44J2ju3gNwyBv7/KhJpr/0eLKZc4uu+cu0E6iGEMrSgND X-Received: by 10.182.104.200 with SMTP id gg8mr3060145obb.45.1396006942712; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.72 with SMTP id s66ls1540600qgs.85.gmail; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) X-Received: by 10.52.171.68 with SMTP id as4mr5726249vdc.0.1396006942632; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id fn10si1191026vdc.99.2014.03.28.04.42.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:42:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id il7so5786885vcb.32 for ; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) X-Received: by 10.58.57.67 with SMTP id g3mr6697943veq.3.1396006942543; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp1535vcv; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) X-Received: by 10.68.200.133 with SMTP id js5mr8146474pbc.138.1396006941854; Fri, 28 Mar 2014 04:42:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si3523370pbd.159.2014.03.28.04.42.21; Fri, 28 Mar 2014 04:42:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751982AbaC1LmG (ORCPT + 27 others); Fri, 28 Mar 2014 07:42:06 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:52276 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbaC1LmD (ORCPT ); Fri, 28 Mar 2014 07:42:03 -0400 Received: by mail-wg0-f43.google.com with SMTP id x13so3409450wgg.2 for ; Fri, 28 Mar 2014 04:42:01 -0700 (PDT) X-Received: by 10.180.73.141 with SMTP id l13mr11958063wiv.60.1396006921217; Fri, 28 Mar 2014 04:42:01 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id t1sm2223565wia.1.2014.03.28.04.41.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:42:00 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, linaro-networking@linaro.org, Arvind.Chauhan@arm.com, Viresh Kumar Subject: [PATCH 02/16] hrtimer: reorder code in __remove_hrtimer() Date: Fri, 28 Mar 2014 17:11:21 +0530 Message-Id: <9ea86197955aee2b751ccb5a8ea746dbd3244850.1396006658.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch reorders code within __remove_hrtimer() routine to achieve this: - no need to check if timer is the next timer to expire when high resolution mode isn't configured in kernel. - no need of local variable 'next_timer' - Validate 'reprogram' and hrtimer_hres_active() first as without these we don't need to check if timer is the next timer to fire. Signed-off-by: Viresh Kumar --- kernel/hrtimer.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index a710638..6476152 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -887,25 +887,22 @@ static void __remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, unsigned long newstate, int reprogram) { - struct timerqueue_node *next_timer; if (!(timer->state & HRTIMER_STATE_ENQUEUED)) goto out; - next_timer = timerqueue_getnext(&base->active); timerqueue_del(&base->active, &timer->node); - if (&timer->node == next_timer) { + #ifdef CONFIG_HIGH_RES_TIMERS - /* Reprogram the clock event device. if enabled */ - if (reprogram && hrtimer_hres_active()) { - ktime_t expires; - - expires = ktime_sub(hrtimer_get_expires(timer), - base->offset); - if (base->cpu_base->expires_next.tv64 == expires.tv64) - hrtimer_force_reprogram(base->cpu_base, 1); - } -#endif + /* Reprogram the clock event device. if enabled */ + if (reprogram && hrtimer_hres_active() && + &timer->node == timerqueue_getnext(&base->active)) { + ktime_t expires; + + expires = ktime_sub(hrtimer_get_expires(timer), base->offset); + if (base->cpu_base->expires_next.tv64 == expires.tv64) + hrtimer_force_reprogram(base->cpu_base, 1); } +#endif if (!timerqueue_getnext(&base->active)) base->cpu_base->active_bases &= ~(1 << base->index); out: