Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965470Ab3DTA3i (ORCPT ); Fri, 19 Apr 2013 20:29:38 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:47892 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965184Ab3DTA3J (ORCPT ); Fri, 19 Apr 2013 20:29:09 -0400 X-IronPort-AV: E=Sophos;i="4.87,512,1363158000"; d="scan'208";a="40095502" From: Stephen Boyd To: Rob Herring Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , arm@kernel.org, Catalin Marinas , Will Deacon , John Stultz , Thomas Gleixner Subject: [PATCH 2/4] ARM: sched_clock: Return suspended count earlier Date: Fri, 19 Apr 2013 17:29:04 -0700 Message-Id: <1366417746-24990-3-git-send-email-sboyd@codeaurora.org> X-Mailer: git-send-email 1.8.2.1.392.g85e7e81 In-Reply-To: <1366417746-24990-1-git-send-email-sboyd@codeaurora.org> References: <1366417746-24990-1-git-send-email-sboyd@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1505 Lines: 44 If we're suspended and sched_clock() is called we're going to read the hardware one more time and throw away that value and return back the cached value we saved during the suspend callback. This is wasteful, let's short circuit all that and return the cached value if we're suspended as early as possible. Signed-off-by: Stephen Boyd --- arch/arm/kernel/sched_clock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 48ab64a..29ac613 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c @@ -55,9 +55,6 @@ static unsigned long long cyc_to_sched_clock(u32 cyc, u32 mask) u64 epoch_ns; u32 epoch_cyc; - if (cd.suspended) - return cd.epoch_ns; - /* * Load the epoch_cyc and epoch_ns atomically. We do this by * ensuring that we always write epoch_cyc, epoch_ns and @@ -174,6 +171,9 @@ unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32; unsigned long long notrace sched_clock(void) { + if (cd.suspended) + return cd.epoch_ns; + return sched_clock_func(); } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/