mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Christoph Lameter <cl@gentwo.org>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	"H. Peter Anvin" <hpa@linux.intel.com>
Subject: Re: x86: use this_cpu for debug_stack_usage
Date: Tue, 06 Aug 2013 15:02:45 -0400	[thread overview]
Message-ID: <1375815765.25420.45.camel@gandalf.local.home> (raw)
In-Reply-To: <0000014054fd1db5-e6fbcc32-2e6c-49b1-83d4-399791ee6829-000000@email.amazonses.com>

On Tue, 2013-08-06 at 18:56 +0000, Christoph Lameter wrote:
> > Might as well change is_debug_stack() to use __this_cpu_read() instead
> > of __get_cpu_var().

I just noticed that you didn't include the x86 maintainers.

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> 
> 
> 
> 
> 
> Subject: x86: use this_cpu for debug_stack_usage
> 
> Reduces overhead a bit and frees up a couple of registers.
> 
> Signed-off-by: Christoph Lameter <cl@linux.com>
> 
> Index: linux/arch/x86/include/asm/debugreg.h
> ===================================================================
> --- linux.orig/arch/x86/include/asm/debugreg.h	2013-08-06 13:52:23.740092873 -0500
> +++ linux/arch/x86/include/asm/debugreg.h	2013-08-06 13:52:23.740092873 -0500
> @@ -97,11 +97,11 @@ extern void hw_breakpoint_restore(void);
>  DECLARE_PER_CPU(int, debug_stack_usage);
>  static inline void debug_stack_usage_inc(void)
>  {
> -	__get_cpu_var(debug_stack_usage)++;
> +	__this_cpu_inc(debug_stack_usage);
>  }
>  static inline void debug_stack_usage_dec(void)
>  {
> -	__get_cpu_var(debug_stack_usage)--;
> +	__this_cpu_dec(debug_stack_usage);
>  }
>  int is_debug_stack(unsigned long addr);
>  void debug_stack_set_zero(void);
> Index: linux/arch/x86/kernel/cpu/common.c
> ===================================================================
> --- linux.orig/arch/x86/kernel/cpu/common.c	2013-07-19 09:06:36.850047837 -0500
> +++ linux/arch/x86/kernel/cpu/common.c	2013-08-06 13:54:36.426384889 -0500
> @@ -1144,9 +1144,9 @@ DEFINE_PER_CPU(int, debug_stack_usage);
> 
>  int is_debug_stack(unsigned long addr)
>  {
> -	return __get_cpu_var(debug_stack_usage) ||
> -		(addr <= __get_cpu_var(debug_stack_addr) &&
> -		 addr > (__get_cpu_var(debug_stack_addr) - DEBUG_STKSZ));
> +	return __this_cpu_read(debug_stack_usage) ||
> +		(addr <= __this_cpu_read(debug_stack_addr) &&
> +		 addr > (__this_cpu_read(debug_stack_addr) - DEBUG_STKSZ));
>  }
> 
>  DEFINE_PER_CPU(u32, debug_idt_ctr);



  reply	other threads:[~2013-08-06 19:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 17:01 Christoph Lameter
2013-08-06 17:50 ` Steven Rostedt
2013-08-06 18:50   ` Christoph Lameter
2013-08-06 18:56   ` Christoph Lameter
2013-08-06 19:02     ` Steven Rostedt [this message]
2013-08-06 20:07       ` H. Peter Anvin
2013-08-06 20:11         ` Steven Rostedt

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=1375815765.25420.45.camel@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=cl@gentwo.org \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®