public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	"open list:SCHEDULER" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/clock: Remove pointless test in cpu_clock/local_clock
Date: Fri, 1 Apr 2016 19:59:40 +0200	[thread overview]
Message-ID: <56FEB70C.6030703@linaro.org> (raw)
In-Reply-To: <20160401151017.GK3448@twins.programming.kicks-ass.net>

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).

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

      reply	other threads:[~2016-04-01 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 13:46 [PATCH] sched/clock: Remove pointless test in cpu_clock/local_clock Daniel Lezcano
2016-04-01 15:10 ` Peter Zijlstra
2016-04-01 17:59   ` Daniel Lezcano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FEB70C.6030703@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox