From patchwork Fri Apr 1 13:46:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 64859 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp746901lbc; Fri, 1 Apr 2016 06:47:54 -0700 (PDT) X-Received: by 10.67.30.163 with SMTP id kf3mr31153531pad.45.1459518474509; Fri, 01 Apr 2016 06:47:54 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lk8si21505022pab.112.2016.04.01.06.47.54; Fri, 01 Apr 2016 06:47:54 -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 S1754622AbcDANrw (ORCPT + 29 others); Fri, 1 Apr 2016 09:47:52 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:32953 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbcDANrv (ORCPT ); Fri, 1 Apr 2016 09:47:51 -0400 Received: by mail-wm0-f52.google.com with SMTP id f198so26851166wme.0 for ; Fri, 01 Apr 2016 06:47:50 -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=CpSzNVhTQ3lW9DMedeVtKV/PUeMaxoO3KDuoHrYT5p4=; b=QgebXqRK0gSiPovONcR8xG1zDOlLGPhaTcP6g/i+wsu7p53HLBghRsFgd2kIuEDv1Y 7pRhFr/UIFAi4g/dlPnbet9aE3MdGZXMQWK+bMaHpm7vC2TXBNVxI53zBHzHJC5Kk8mv cEP91bViYrD/R7MHHmKpw6EhohjNKm+zRQ8dQ= 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=CpSzNVhTQ3lW9DMedeVtKV/PUeMaxoO3KDuoHrYT5p4=; b=lWfZNdkhhlnW3/WHKxmbmatFybmY+VmxquC0jMWERAxHpq6JBwwfPjJ7FPsSUdrfVx CKROLUwtrRKlD2GnHODD7MqQRVVtlPN5te4tR4R2Lo1vdbuCoTD0acfE+fleOSB/VJ6/ PGKVbenKQh3Nd9EPxDebw8RhiBRVT8nxXNo3y3bm5Enx+FEwb4PQpeMReLmCZrNsWopg mQkxTCuzvk1H5QodlWxkQpbrmcAHMowTMNHge1vezrOjCwmxFcVAmK99mzE0m915ZIT4 tOcGk0EoTrNnNYiur3ZEpglFe9Xt6l1znJzAO9nwpZvQyscLqMc0AB1tD7h1Gv9a4KWJ B4Ag== X-Gm-Message-State: AD7BkJKKVTX3+yJ/KfYw17XnTzSlPkgrhlVflHR5XNzWt2PWreqcWYvKO3SoF72Dkr5qV0UW X-Received: by 10.28.143.9 with SMTP id r9mr3983952wmd.37.1459518470165; Fri, 01 Apr 2016 06:47:50 -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 ei9sm14184007wjd.40.2016.04.01.06.47.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Apr 2016 06:47:49 -0700 (PDT) From: Daniel Lezcano To: peterz@infradead.org Cc: Ingo Molnar , linux-kernel@vger.kernel.org (open list:SCHEDULER) Subject: [PATCH] sched/clock: Remove pointless test in cpu_clock/local_clock Date: Fri, 1 Apr 2016 15:46:48 +0200 Message-Id: <1459518409-9448-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. We can assume gcc is smart enough to inline cpu_clock()/local_clock() to sched_clock_cpu(). Signed-off-by: Daniel Lezcano --- 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 */