From patchwork Mon Apr 14 16:23:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28342 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 029FB20534 for ; Mon, 14 Apr 2014 16:26:52 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 9sf18908935ykp.5 for ; Mon, 14 Apr 2014 09:26:52 -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=TjBcqTYijdPTprrh4C26h4I/2NMhvucziP1oqBwgRRs=; b=hCt2p6X1d7CojdTC3gtZQdylnCIBkN2HV1fnVr+GF5dUT8OFkCN1dtiQRetXX59Uqr PzSr0RhDiJDV1/yUFmPBLSnKmv0kw074Hq53dWrFUrNY+/Ii0BnW1946aSJqJg83P7L9 IMeflUhSNhL0GZhUhKkA/MEV+WnXIfjxncMXwG7TTgXsknO3cQF1+Laae1XV/cvBrTGp n0OY49j1hJW6Wqr9McX9RumoTemcVH+9eeI5oawQQvZAEsF2rOZH6ajFBFnNexFg74yv yp4Bw/rAiHFqvEadg7il+hJOM2AyuAcz+f3ULmic1FJUdDDpivxNPff8Z4pESicJpEEU 7OhQ== X-Gm-Message-State: ALoCoQkElpmvQQ0+GV6WDIbWx+Sf5nzo1xhV0WvpynhBQA3B+PKDg+cPpfId+jf9VUmI4JAMGO9l X-Received: by 10.224.74.74 with SMTP id t10mr8822917qaj.5.1397492812690; Mon, 14 Apr 2014 09:26:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.231 with SMTP id h94ls2582899qgd.61.gmail; Mon, 14 Apr 2014 09:26:52 -0700 (PDT) X-Received: by 10.221.22.71 with SMTP id qv7mr965447vcb.34.1397492812586; Mon, 14 Apr 2014 09:26:52 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id cx1si1498755vdb.2.2014.04.14.09.26.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:26:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 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.176; Received: by mail-vc0-f176.google.com with SMTP id lc6so7604606vcb.7 for ; Mon, 14 Apr 2014 09:26:52 -0700 (PDT) X-Received: by 10.220.198.197 with SMTP id ep5mr3993167vcb.21.1397492812499; Mon, 14 Apr 2014 09:26:52 -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 ib8csp162820vcb; Mon, 14 Apr 2014 09:26:51 -0700 (PDT) X-Received: by 10.68.195.104 with SMTP id id8mr45042738pbc.102.1397492811639; Mon, 14 Apr 2014 09:26:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cz5si6356524pbb.493.2014.04.14.09.26.51; Mon, 14 Apr 2014 09:26:51 -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 S1755690AbaDNQ0j (ORCPT + 26 others); Mon, 14 Apr 2014 12:26:39 -0400 Received: from mail-pb0-f49.google.com ([209.85.160.49]:48795 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755633AbaDNQ0e (ORCPT ); Mon, 14 Apr 2014 12:26:34 -0400 Received: by mail-pb0-f49.google.com with SMTP id jt11so8407280pbb.36 for ; Mon, 14 Apr 2014 09:26:33 -0700 (PDT) X-Received: by 10.68.166.36 with SMTP id zd4mr722591pbb.54.1397492793725; Mon, 14 Apr 2014 09:26:33 -0700 (PDT) Received: from localhost ([122.167.126.16]) by mx.google.com with ESMTPSA id qc8sm34693607pbc.68.2014.04.14.09.26.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:26:32 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Arvind.Chauhan@arm.com, linaro-networking@linaro.org, Viresh Kumar Subject: [PATCH 23/38] tick-sched: invert parameter of tick_check_oneshot_change() Date: Mon, 14 Apr 2014 21:53:45 +0530 Message-Id: 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.176 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(). Firstly hrtimer_run_pending() is calling this routine after doing a '!' of its parameter and then tick_check_oneshot_change() is also using it after doing a '!' of its parameter. It would be more efficient and readable if we can just invert the meaning of this parameter. So, it is 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 b8ee6f4..801e844 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 c81b6cf..256f4a3 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1177,11 +1177,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); @@ -1194,7 +1194,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();