From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754084AbcDAR7o (ORCPT ); Fri, 1 Apr 2016 13:59:44 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:34836 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753920AbcDAR7n (ORCPT ); Fri, 1 Apr 2016 13:59:43 -0400 Subject: Re: [PATCH] sched/clock: Remove pointless test in cpu_clock/local_clock To: Peter Zijlstra References: <1459518409-9448-1-git-send-email-daniel.lezcano@linaro.org> <20160401151017.GK3448@twins.programming.kicks-ass.net> Cc: Ingo Molnar , "open list:SCHEDULER" From: Daniel Lezcano Message-ID: <56FEB70C.6030703@linaro.org> Date: Fri, 1 Apr 2016 19:59:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160401151017.GK3448@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/01/2016 05:10 PM, Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 03:46:48PM +0200, Daniel Lezcano wrote: > >> 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(). > > Why assume if you can easily check; so does it indeed inline? Actually, no. They are not inlined. With this patch we end up with one line functions: #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK u64 cpu_clock(int cpu) { return sched_clock_cpu(cpu); } u64 local_clock(void) { return sched_clock_cpu(raw_smp_processor_id()); } #else u64 cpu_clock(int cpu) { return sched_clock(); } u64 local_clock(void) { return sched_clock(); } #endif is it worth to convert them to static inline function ? (static inline does effectively inline those functions). -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog