public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Chen Gang <gang.chen@asianux.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Paul McKenney <paulmck@linux.vnet.ibm.com>,
	khilman@linaro.org, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel: context_tracking: use extern function instead of static inline function for user_enter/exit()
Date: Wed, 23 Oct 2013 06:47:24 -0400	[thread overview]
Message-ID: <1382525244.5283.3.camel@pippen.local.home> (raw)
In-Reply-To: <5267A72B.7060808@asianux.com>

On Wed, 2013-10-23 at 18:38 +0800, Chen Gang wrote:

> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  include/linux/context_tracking.h |   14 ++------------
>  kernel/context_tracking.c        |   12 ++++++++++++
>  2 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
> index 1581587..bf220f7 100644
> --- a/include/linux/context_tracking.h
> +++ b/include/linux/context_tracking.h
> @@ -10,23 +10,13 @@
>  #ifdef CONFIG_CONTEXT_TRACKING
>  extern void context_tracking_cpu_set(int cpu);
>  
> +extern void user_enter(void);
> +extern void user_exit(void);
>  extern void context_tracking_user_enter(void);
>  extern void context_tracking_user_exit(void);
>  extern void __context_tracking_task_switch(struct task_struct *prev,
>  					   struct task_struct *next);
>  
> -static inline void user_enter(void)
> -{
> -	if (static_key_false(&context_tracking_enabled))
> -		context_tracking_user_enter();
> -
> -}
> -static inline void user_exit(void)
> -{
> -	if (static_key_false(&context_tracking_enabled))
> -		context_tracking_user_exit();
> -}
> -
>  static inline enum ctx_state exception_enter(void)
>  {
>  	enum ctx_state prev_ctx;
> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> index 013161f..c03d0d6 100644
> --- a/kernel/context_tracking.c
> +++ b/kernel/context_tracking.c
> @@ -29,6 +29,18 @@ EXPORT_SYMBOL_GPL(context_tracking_enabled);
>  DEFINE_PER_CPU(struct context_tracking, context_tracking);
>  EXPORT_SYMBOL_GPL(context_tracking);
>  
> +void user_enter(void)
> +{
> +	if (static_key_false(&context_tracking_enabled))
> +		context_tracking_user_enter();
> +}
> +
> +void user_exit(void)
> +{
> +	if (static_key_false(&context_tracking_enabled))
> +		context_tracking_user_exit();
> +}
> +
>  void context_tracking_cpu_set(int cpu)
>  {
>  	if (!per_cpu(context_tracking.active, cpu)) {

Ug, you just put an unneeded function call into a fast path because of a
failure with a particular arch.

If you need the assembly to call this code, then make yourself a wrapper
function to call that does the user_enter/exit() calls.

void arch_user_enter(void)
{
	user_enter();
}

-- Steve



  reply	other threads:[~2013-10-23 10:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 10:38 [PATCH] kernel: context_tracking: use extern function instead of static inline function for user_enter/exit() Chen Gang
2013-10-23 10:47 ` Steven Rostedt [this message]
2013-10-23 11:01   ` Chen Gang
2013-10-23 11:15     ` Steven Rostedt
2013-10-23 11:31       ` Chen Gang
2013-10-23 11:11 ` Frederic Weisbecker
2013-10-23 11:19   ` Chen Gang

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=1382525244.5283.3.camel@pippen.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=gang.chen@asianux.com \
    --cc=khilman@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.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