From patchwork Mon Apr 21 09:55:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28681 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B1E312032B for ; Mon, 21 Apr 2014 09:57:56 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id lx4sf26911187iec.7 for ; Mon, 21 Apr 2014 02:57:56 -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=XI2/Fs9JQbEFctfmrOocK+nLuBk397z4UmdAOeM7BI8=; b=XHcAAsaMRg9xGxo3/PKWVkWBSFl7SYg+rjHkc3DyELEHqZmd8VVVS3fnxagLTDBeip 8+Ge4WenLt3lWbq7O+cwB4rmOlgdtP2lPQllpzUQA+q1OlUnyjNMOgEdO2+HENShgdzM GoY2ZrE5mCcM21QA9zrFDyUjuZerdQSbkXKPcgyFPQmOkQyEbZeOws2JE5R+uavX6HyQ dghbrFl/mH2M/iMCmrFcDwCyG+G09Xgvxca8Ut3O0+cglrH7hsWVXZAdroqdZBTdhbog rDC1KH/5icyRf/X1KKLn4XGbrL6iuE2a1h10O+PLuLLWzvtA1RH0Lh2geTrZDYMjhVkN qbIQ== X-Gm-Message-State: ALoCoQliI36bhFV6bCq4MQ6gPLfQM/7RGgMHd9GFajwgoBu96LbhU9UPOgKsgorlHs4jd33gR590 X-Received: by 10.182.79.41 with SMTP id g9mr18764862obx.41.1398074276121; Mon, 21 Apr 2014 02:57:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.84 with SMTP id h78ls318315qge.54.gmail; Mon, 21 Apr 2014 02:57:56 -0700 (PDT) X-Received: by 10.220.10.2 with SMTP id n2mr706696vcn.26.1398074275985; Mon, 21 Apr 2014 02:57:55 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id w19si311324vcf.167.2014.04.21.02.57.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 02:57:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id db12so7398146veb.24 for ; Mon, 21 Apr 2014 02:57:55 -0700 (PDT) X-Received: by 10.58.123.71 with SMTP id ly7mr33524106veb.11.1398074275902; Mon, 21 Apr 2014 02:57:55 -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.221.72 with SMTP id ib8csp280310vcb; Mon, 21 Apr 2014 02:57:55 -0700 (PDT) X-Received: by 10.68.202.230 with SMTP id kl6mr37301049pbc.55.1398074275107; Mon, 21 Apr 2014 02:57:55 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pu6si18463104pac.184.2014.04.21.02.57.54; Mon, 21 Apr 2014 02:57:54 -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 S1752212AbaDUJ5r (ORCPT + 26 others); Mon, 21 Apr 2014 05:57:47 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:36411 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbaDUJ5K (ORCPT ); Mon, 21 Apr 2014 05:57:10 -0400 Received: by mail-wi0-f181.google.com with SMTP id hm4so1629341wib.2 for ; Mon, 21 Apr 2014 02:57:09 -0700 (PDT) X-Received: by 10.180.94.226 with SMTP id df2mr13307041wib.1.1398074229188; Mon, 21 Apr 2014 02:57:09 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id cd10sm15241289wib.0.2014.04.21.02.57.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 21 Apr 2014 02:57:08 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linaro-networking@linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Viresh Kumar Subject: [PATCH V2 18/19] tick-sched: invert parameter of tick_check_oneshot_change() Date: Mon, 21 Apr 2014 15:25:14 +0530 Message-Id: <0e5e2a44a07af7fe17d70bb4d45dd7b032e92a35.1398072824.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.128.179 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: , There is only one caller of tick_check_oneshot_change(), i.e. hrtimer_run_pending(). hrtimer_run_pending() calls this routine after doing a logical NOT (!) of its parameter and then tick_check_oneshot_change() also uses its parameter after doing logical NOT (!) of it. It would be more efficient and readable if we can just invert the meaning of this parameter. It is called hres_enabled instead of allow_nohz now. Signed-off-by: Viresh Kumar --- include/linux/tick.h | 6 +++--- kernel/hrtimer.c | 2 +- kernel/time/tick-sched.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index f538a4d..1065a51 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -120,7 +120,7 @@ extern struct cpumask *tick_get_broadcast_oneshot_mask(void); # ifdef CONFIG_TICK_ONESHOT extern void tick_clock_notify(void); -extern int tick_check_oneshot_change(int allow_nohz); +extern int tick_check_oneshot_change(int hres_enabled); extern struct tick_sched *tick_get_tick_sched(int cpu); extern void tick_irq_enter(void); extern int tick_oneshot_mode_active(void); @@ -129,7 +129,7 @@ extern int tick_oneshot_mode_active(void); # endif # else static inline void tick_clock_notify(void) { } -static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } +static inline int tick_check_oneshot_change(int hres_enabled) { return 0; } static inline void tick_irq_enter(void) { } static inline int tick_oneshot_mode_active(void) { return 0; } # endif @@ -138,7 +138,7 @@ static inline int tick_oneshot_mode_active(void) { return 0; } static inline void tick_init(void) { } static inline void tick_cancel_sched_timer(int cpu) { } static inline void tick_clock_notify(void) { } -static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } +static inline int tick_check_oneshot_change(int hres_enabled) { return 0; } static inline void tick_irq_enter(void) { } static inline int tick_oneshot_mode_active(void) { return 0; } #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 393f422..bfa7811 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1457,7 +1457,7 @@ void hrtimer_run_pending(void) * check bit in the tick_oneshot code, otherwise we might * deadlock vs. xtime_lock. */ - if (tick_check_oneshot_change(!hrtimer_is_hres_enabled())) + if (tick_check_oneshot_change(hrtimer_is_hres_enabled())) hrtimer_switch_to_hres(); } diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 4a94412..77084fa 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1195,11 +1195,11 @@ void tick_oneshot_notify(void) * Check, if a change happened, which makes oneshot possible. * * Called cyclic from the hrtimer softirq (driven by the timer - * softirq) allow_nohz signals, that we can switch into low-res nohz - * mode, because high resolution timers are disabled (either compile - * or runtime). + * softirq). If hres_enabled is non zero, it means we can't switch into low-res + * nohz mode, because high resolution timers are enabled(either compile or + * runtime). */ -int tick_check_oneshot_change(int allow_nohz) +int tick_check_oneshot_change(int hres_enabled) { struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); @@ -1212,7 +1212,7 @@ int tick_check_oneshot_change(int allow_nohz) if (!timekeeping_valid_for_hres() || !tick_is_oneshot_available()) return 0; - if (!allow_nohz) + if (hres_enabled) return 1; tick_nohz_switch_to_nohz();