From patchwork Mon Apr 11 14:38:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 65526 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1513034lbl; Mon, 11 Apr 2016 07:39:31 -0700 (PDT) X-Received: by 10.66.251.10 with SMTP id zg10mr33237645pac.1.1460385567277; Mon, 11 Apr 2016 07:39:27 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q73si3850929pfi.65.2016.04.11.07.39.26; Mon, 11 Apr 2016 07:39:27 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753655AbcDKOjY (ORCPT + 29 others); Mon, 11 Apr 2016 10:39:24 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37733 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750928AbcDKOjV (ORCPT ); Mon, 11 Apr 2016 10:39:21 -0400 Received: by mail-wm0-f46.google.com with SMTP id n3so107682452wmn.0 for ; Mon, 11 Apr 2016 07:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=EBWpEJr3ggEHVSH/Iy7zPn6hIXRHYLSK8ZII9qIOaI0=; b=Rmh8x+ZupXQvhFLLT7YVO8qPKNgKkdjYR1Xko1uXYx0MB/7/jyJSvaCeu/gdNid1bk E7BxShZDcMw5AGweVi9RB751meSbBkkp/uhjvQdgwbmK4xrG7IbobPLmhOyXcKBRwpNZ paMvsO4tV3eyEDVU7Bdddq2nqE/kFD1U2BbkI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EBWpEJr3ggEHVSH/Iy7zPn6hIXRHYLSK8ZII9qIOaI0=; b=YpYWJ65Vqw5SmRc2nHxhLX3CaDODR458cggMd9rVGLvrFw0CB3ojXR3utRZSeEUFTQ vDbSOKWfLP/MmiBllre0LHCHYzVVJKc9FJwbDYmMx2EpULVAeHyU9Lq0anv7Oy72rSEh NNLhQTMuL6lSaWNuRwygSmhqc10REqJfX49q7yuPQp9jA/VHe5yMJk5Oonv8dFzcgn0G Mhrzxq7jcBq7DIn0CJWxLeRhGUYWMBwX5FjyFfx7DButfe9zMbaMWkNRk0d1p7ezrYM+ /tQxNdTR6Czybx4sb3D3875O+VOMxVaW97ab/rmbghy4Pid5xv6W3kHzmIQjsLtVAZi2 7A4w== X-Gm-Message-State: AD7BkJI0byGXykQb8Xf5y1/cfWg1/0DzTHBp7kZ3oEduME1b7XUnndXukps9AkMyzZAgM+sP X-Received: by 10.195.13.135 with SMTP id ey7mr24054050wjd.161.1460385554760; Mon, 11 Apr 2016 07:39:14 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id om6sm28175798wjc.40.2016.04.11.07.39.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Apr 2016 07:39:14 -0700 (PDT) From: Daniel Lezcano To: peterz@infradead.org Cc: Ingo Molnar , linux-kernel@vger.kernel.org (open list:SCHEDULER) Subject: [PATCH V2 1/2] sched/clock: Remove pointless test in cpu_clock/local_clock Date: Mon, 11 Apr 2016 16:38:33 +0200 Message-Id: <1460385514-14700-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case the HAVE_UNSTABLE_SCHED_CLOCK config is set, the cpu_clock() version checks if sched_clock_stable() is not set and calls sched_clock_cpu(), otherwise it calls sched_clock(). sched_clock_cpu() checks also if sched_clock_stable() is set and, if true, calls sched_clock(). sched_clock() will be called in sched_clock_cpu() if sched_clock_stable() is true. Remove the duplicate test by directly calling sched_clock_cpu() and let the static key act in this function instead. Signed-off-by: Daniel Lezcano --- V2: - Remove "assumption" comment about gcc inlining the functions --- kernel/sched/clock.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c index fedb967..30c4b20 100644 --- a/kernel/sched/clock.c +++ b/kernel/sched/clock.c @@ -375,10 +375,7 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event); */ u64 cpu_clock(int cpu) { - if (!sched_clock_stable()) - return sched_clock_cpu(cpu); - - return sched_clock(); + return sched_clock_cpu(cpu); } /* @@ -390,10 +387,7 @@ u64 cpu_clock(int cpu) */ u64 local_clock(void) { - if (!sched_clock_stable()) - return sched_clock_cpu(raw_smp_processor_id()); - - return sched_clock(); + return sched_clock_cpu(raw_smp_processor_id()); } #else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */