All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/9] ftrace: use this_cpu_ptr per-cpu helper
@ 2012-10-31 11:22 Shan Wei
  2012-10-31 17:43 ` Christoph Lameter
  0 siblings, 1 reply; 2+ messages in thread
From: Shan Wei @ 2012-10-31 11:22 UTC (permalink / raw)
  To: rostedt, fweisbec, mingo, Kernel-Maillist, cl

From: Shan Wei <davidshan@tencent.com>

Signed-off-by: Shan Wei <davidshan@tencent.com>
---
 include/trace/ftrace.h |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index a763888..7c9fde7 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -638,7 +638,6 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
  *	struct trace_entry *ent;
  *	int __entry_size;
  *	int __data_size;
- *	int __cpu
  *	int pc;
  *
  *	pc = preempt_count();
@@ -654,7 +653,6 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
  *	// Protect the non nmi buffer
  *	// This also protects the rcu read side
  *	local_irq_save(irq_flags);
- *	__cpu = smp_processor_id();
  *
  *	if (in_nmi())
  *		trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
@@ -664,7 +662,7 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
  *	if (!trace_buf)
  *		goto end;
  *
- *	trace_buf = per_cpu_ptr(trace_buf, __cpu);
+ *	trace_buf = this_cpu_ptr(trace_buf);
  *
  * 	// Avoid recursion from perf that could mess up the buffer
  * 	if (trace_buf->recursion++)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 5/9] ftrace: use this_cpu_ptr per-cpu helper
  2012-10-31 11:22 [PATCH 5/9] ftrace: use this_cpu_ptr per-cpu helper Shan Wei
@ 2012-10-31 17:43 ` Christoph Lameter
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Lameter @ 2012-10-31 17:43 UTC (permalink / raw)
  To: Shan Wei; +Cc: rostedt, fweisbec, mingo, Kernel-Maillist

On Wed, 31 Oct 2012, Shan Wei wrote:

> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index a763888..7c9fde7 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -638,7 +638,6 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
>   *	struct trace_entry *ent;
>   *	int __entry_size;
>   *	int __data_size;
> - *	int __cpu
>   *	int pc;
>   *
>   *	pc = preempt_count();
> @@ -654,7 +653,6 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
>   *	// Protect the non nmi buffer
>   *	// This also protects the rcu read side
>   *	local_irq_save(irq_flags);
> - *	__cpu = smp_processor_id();
>   *
>   *	if (in_nmi())
>   *		trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
> @@ -664,7 +662,7 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
>   *	if (!trace_buf)
>   *		goto end;
>   *
> - *	trace_buf = per_cpu_ptr(trace_buf, __cpu);
> + *	trace_buf = this_cpu_ptr(trace_buf);
>   *
>   * 	// Avoid recursion from perf that could mess up the buffer
>   * 	if (trace_buf->recursion++)

Reviewed-by: Christoph Lameter <cl@linux.com>

Code could be further reduced by not doing the this_cpu_ptr op but using
this_cpu_read later instead.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-31 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-31 11:22 [PATCH 5/9] ftrace: use this_cpu_ptr per-cpu helper Shan Wei
2012-10-31 17:43 ` Christoph Lameter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.