From patchwork Fri Mar 28 11:41:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27272 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 70B4820062 for ; Fri, 28 Mar 2014 11:44:05 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id n16sf17560310oag.1 for ; Fri, 28 Mar 2014 04:44:04 -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=XBTkOsLI7EDr9ozYsOSlpOSj1qN2Bm92aW0hYBsduAw=; b=aesDcXzpMRdAZlJ29J3hp15tdoLISXCo7ewyYYY7uX3SUc9qWjdkh5AwYpXDjyHBD4 mjAnVUbqwmWfgx46+VoeqKDaCidRuFtly6BxXRQ75/UZ9r0bPU9/312g6heuCmI6hbRf Xa7rjxGmNSZCYJpwjbl+Ir4pU7V+Rb1CsP50nLcgfBkk6OpYgZFbpiZaWPz/3PEn9i05 w4LjCnm6WO9Uuhn0BNhuD6OF3JmUK0l94w40HoDaaPB6ZX+TjmNYTi4kFrMEQjNDmxnt zJqG3fuBZioE0BnD0+i9KnWCLCOENp/dY9TwElg3QXTcLmSWtVN61QUUfpwT91WfoZ+y nd/Q== X-Gm-Message-State: ALoCoQnRAqS6Pxu6s6v1UQaNfWpl205h1mmTvw3+H0rBdMMWsTFSRHCazjCqz484ms9DDXNHSrjF X-Received: by 10.43.141.196 with SMTP id jf4mr2788766icc.9.1396007044896; Fri, 28 Mar 2014 04:44:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.233 with SMTP id l96ls1484025qgl.90.gmail; Fri, 28 Mar 2014 04:44:04 -0700 (PDT) X-Received: by 10.220.103.141 with SMTP id k13mr169190vco.25.1396007044777; Fri, 28 Mar 2014 04:44:04 -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 sh5si1195064vdc.50.2014.03.28.04.44.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:44:04 -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 il7so5660332vcb.18 for ; Fri, 28 Mar 2014 04:44:04 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr5802221vdb.20.1396007044688; Fri, 28 Mar 2014 04:44:04 -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 v8csp1624vcv; Fri, 28 Mar 2014 04:44:04 -0700 (PDT) X-Received: by 10.66.243.70 with SMTP id ww6mr8077057pac.47.1396007043986; Fri, 28 Mar 2014 04:44:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sh5si3503151pbc.450.2014.03.28.04.44.03; Fri, 28 Mar 2014 04:44:03 -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 S1752472AbaC1Lnm (ORCPT + 27 others); Fri, 28 Mar 2014 07:43:42 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:49966 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbaC1Lni (ORCPT ); Fri, 28 Mar 2014 07:43:38 -0400 Received: by mail-wi0-f179.google.com with SMTP id f8so648475wiw.12 for ; Fri, 28 Mar 2014 04:43:37 -0700 (PDT) X-Received: by 10.180.11.239 with SMTP id t15mr20241959wib.51.1396007017770; Fri, 28 Mar 2014 04:43:37 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id dd5sm6415773wib.12.2014.03.28.04.43.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:43:37 -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 15/16] hrtimer: create base_on_this_cpu() Date: Fri, 28 Mar 2014 17:11:34 +0530 Message-Id: <24bf5c053d9b39412b0f2d56d980bf9d85149ae2.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: , We had this code at two places to find if a clock base belongs to current CPU: base->cpu_base == &__get_cpu_var(hrtimer_bases) Better to get a inlined routine for that. Signed-off-by: Viresh Kumar --- kernel/hrtimer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 5d77f36..83e5f2d 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -107,6 +107,10 @@ static inline int hrtimer_clockid_to_base(clockid_t clock_id) return hrtimer_clock_to_base_table[clock_id]; } +static inline bool base_on_this_cpu(struct hrtimer_clock_base *base) +{ + return base->cpu_base == &__get_cpu_var(hrtimer_bases); +} /* * Get the coarse grained time at the softirq based on xtime and @@ -916,8 +920,7 @@ static inline int remove_hrtimer(struct hrtimer *timer) * move the timer base in switch_hrtimer_base. */ state = timer->state & HRTIMER_STATE_CALLBACK; - __remove_hrtimer(timer, state, - timer->base->cpu_base == &__get_cpu_var(hrtimer_bases)); + __remove_hrtimer(timer, state, base_on_this_cpu(timer->base)); return 1; } @@ -964,9 +967,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, * * XXX send_remote_softirq() ? */ - if (hrtimer_is_leftmost(timer) && - new_base->cpu_base == &__get_cpu_var(hrtimer_bases) - && hrtimer_enqueue_reprogram(timer)) { + if (hrtimer_is_leftmost(timer) && base_on_this_cpu(new_base) && + hrtimer_enqueue_reprogram(timer)) { if (wakeup) { /* * We need to drop cpu_base->lock to avoid a