From patchwork Tue Nov 6 10:38:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12676 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 76AC81987CF for ; Tue, 6 Nov 2012 10:39:07 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 24AF8A19396 for ; Tue, 6 Nov 2012 10:39:07 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so313823iej.11 for ; Tue, 06 Nov 2012 02:39:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references:in-reply-to :references:x-originalarrivaltime:x-mc-unique:content-type :content-transfer-encoding:x-gm-message-state; bh=qjFfL3eFD+gTd1LsZgK5vv5F7AEHzvLcqUdq5V6RDPc=; b=RxFwDHhud69s1lRhoVeiHWw7rzk+/bMqD/YgtZ5BJcsIf1I6rFtkuVtvMAOnnh4/AH +Va/U3swmiSbV9yO7xdh+Hk/0DUnIvxYM6TI+YHvZpXhNl6jjLz+215KDVUAJYk1VtaQ ZpaU7Ht/n0bupGEJZG2DkK5LecxcgdD7A8uDf89+NzB3Lhsh+CAXcqzNe0kKD3HTtM/Z /L0PDbb9vwWnUdlEXCsOCqOda4zKEpqqghsdCX9s5viNS9YDjy1Y8ttYZIhihjj0HoLX Cn3FiunzZhRGXCVYWiOVK+pL/kkgUk4uZ3pit1XkMcGDsVSxRU2UUDsyKLladjsoErK5 aQtg== Received: by 10.50.213.34 with SMTP id np2mr444306igc.57.1352198346592; Tue, 06 Nov 2012 02:39:06 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp15158igt; Tue, 6 Nov 2012 02:39:05 -0800 (PST) Received: by 10.180.84.102 with SMTP id x6mr1140603wiy.12.1352198344839; Tue, 06 Nov 2012 02:39:04 -0800 (PST) Received: from service87.mimecast.com (service87.mimecast.com. [91.220.42.44]) by mx.google.com with ESMTP id e10si5217409wix.41.2012.11.06.02.39.04; Tue, 06 Nov 2012 02:39:04 -0800 (PST) Received-SPF: pass (google.com: domain of viresh.kumar2@arm.com designates 91.220.42.44 as permitted sender) client-ip=91.220.42.44; Authentication-Results: mx.google.com; spf=pass (google.com: domain of viresh.kumar2@arm.com designates 91.220.42.44 as permitted sender) smtp.mail=viresh.kumar2@arm.com Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 06 Nov 2012 10:38:56 +0000 Received: from localhost ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 6 Nov 2012 10:38:54 +0000 From: Viresh Kumar To: pjt@google.com, paul.mckenney@linaro.org, tglx@linutronix.de, tj@kernel.org, suresh.b.siddha@intel.com, venki@google.com, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org Cc: Arvind.Chauhan@arm.com, linaro-dev@lists.linaro.org, patches@linaro.org, pdsw-power-team@arm.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 Resend 2/4] timer: hrtimer: Don't check idle_cpu() before calling get_nohz_timer_target() Date: Tue, 6 Nov 2012 16:08:44 +0530 Message-Id: <5caa3dab5feb7cc3d78b4f9a19dbb24401796b53.1352196505.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-OriginalArrivalTime: 06 Nov 2012 10:38:55.0124 (UTC) FILETIME=[EB8DB540:01CDBC0A] X-MC-Unique: 112110610385633701 X-Gm-Message-State: ALoCoQn5L4ZA8Fj5wJJj0EFHdmZvlgw1BqfYXbgE/ZCGQIKvVajYtXR54VppqFdr9Ji3wGCcxn6g Check for current cpu's idleness already done in implementation of sched_select_cpu() which is called by get_nohz_timer_target(). So, no need to call idle_cpu() twice, once from sched_select_cpu() and once from timer and hrtimer before calling get_nohz_timer_target(). This patch removes calls to idle_cpu() from timer and hrtimer. This also reduces an extra call to smp_processor_id() when get_nohz_timer_target() is called. Signed-off-by: Viresh Kumar --- kernel/hrtimer.c | 2 +- kernel/timer.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 6db7a5e..74bdaf6 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -159,7 +159,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, static int hrtimer_get_target(int this_cpu, int pinned) { #ifdef CONFIG_NO_HZ - if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu)) + if (!pinned && get_sysctl_timer_migration()) return get_nohz_timer_target(); #endif return this_cpu; diff --git a/kernel/timer.c b/kernel/timer.c index 367d008..1170ece 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -735,11 +735,13 @@ __mod_timer(struct timer_list *timer, unsigned long expires, debug_activate(timer, expires); - cpu = smp_processor_id(); - #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) - if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) + if (!pinned && get_sysctl_timer_migration()) cpu = get_nohz_timer_target(); + else + cpu = smp_processor_id(); +#else + cpu = smp_processor_id(); #endif new_base = per_cpu(tvec_bases, cpu);