From patchwork Thu Sep 27 09:04:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 11749 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 254B724146 for ; Thu, 27 Sep 2012 09:04:43 +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 BC788A18602 for ; Thu, 27 Sep 2012 09:04:42 +0000 (UTC) Received: by ieje10 with SMTP id e10so3623563iej.11 for ; Thu, 27 Sep 2012 02:04:42 -0700 (PDT) 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=rXO7GmghW08/qP/8TsMKcSIIvItYk8UKdZsOCbgFiyA=; b=KoHMEQmu3n6SN5S0CWDKCt5cRt+HhPOWARwJQTkAymLxF9+lb7IFlBxZz6BLctx2GM UvAJcHAZ1Rld8zpjTB7oNo4bza+GUZ3hM4gFDR4PQVRFZNbWKrb0v9MoghlXYjBUgnEi OxtqE/3/UjYUJy7fppvmeTbwnv5zNoIvgiwFYf/9orBKzQb+UiV49MNowK51yz0vgJPv SYfQdIXWzS502W4P1i6n1+wf7cbwv6N5W2DbqaZ9kx3nzGb7mWdPP9Wy0e2t0kqQFk1z RNDgOtO9SphfHk0JPeuhHYV/hzXR7729usZsEFPVSPqFWktgR9rwYZ3uqN0orDMJoI+W UDqg== Received: by 10.50.217.227 with SMTP id pb3mr13633924igc.28.1348736682234; Thu, 27 Sep 2012 02:04:42 -0700 (PDT) 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.184.232 with SMTP id ex8csp404047igc; Thu, 27 Sep 2012 02:04:41 -0700 (PDT) Received: by 10.216.136.230 with SMTP id w80mr1144350wei.199.1348736680705; Thu, 27 Sep 2012 02:04:40 -0700 (PDT) Received: from service87.mimecast.com (service87.mimecast.com. [91.220.42.44]) by mx.google.com with ESMTP id i9si14382492wiy.24.2012.09.27.02.04.40; Thu, 27 Sep 2012 02:04:40 -0700 (PDT) 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; Thu, 27 Sep 2012 10:04:39 +0100 Received: from localhost ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 27 Sep 2012 10:04:16 +0100 From: Viresh Kumar To: linux-kernel@vger.kernel.org Cc: 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, robin.randhawa@arm.com, Steve.Bannister@arm.com, Arvind.Chauhan@arm.com, amit.kucheria@linaro.org, vincent.guittot@linaro.org, linaro-dev@lists.linaro.org, patches@linaro.org, Viresh Kumar Subject: [PATCH V2 2/3] timer: hrtimer: Don't check idle_cpu() before calling get_nohz_timer_target() Date: Thu, 27 Sep 2012 14:34:04 +0530 Message-Id: <169feed8cddec1edecb311d2471df0a553d6e865.1348736069.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: 27 Sep 2012 09:04:16.0943 (UTC) FILETIME=[12920BF0:01CD9C8F] X-MC-Unique: 112092710043920701 X-Gm-Message-State: ALoCoQkB/esIABofv/GHDZobjm6fgCTCP3z9ExqeeHqbJ8bZ9S1VmQqS8BjMV1K9BdUPo6fG0gLm 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. Signed-off-by: Viresh Kumar --- kernel/hrtimer.c | 2 +- kernel/timer.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 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 d5de1b2..8409d9d 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -720,7 +720,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, { struct tvec_base *base, *new_base; unsigned long flags; - int ret = 0 , cpu; + int ret = 0 , cpu = 0; timer_stats_timer_set_start_info(timer); BUG_ON(!timer->function); @@ -733,12 +733,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(); #endif + if (!cpu) + cpu = smp_processor_id(); + new_base = per_cpu(tvec_bases, cpu); if (base != new_base) {