Subject: [PATCH 07/31] drivers/oprofile: Replace __get_cpu_var uses for address calculation

Replace the uses of __get_cpu_var for address calculation with this_cpu_ptr.

Cc: Robert Richter <[email protected]>
Cc: [email protected]
Signed-off-by: Christoph Lameter <[email protected]>

Index: linux/drivers/oprofile/cpu_buffer.c
===================================================================
--- linux.orig/drivers/oprofile/cpu_buffer.c 2014-04-14 13:24:54.801361443 -0500
+++ linux/drivers/oprofile/cpu_buffer.c 2014-04-14 13:24:54.793361597 -0500
@@ -45,7 +45,7 @@

void oprofile_cpu_buffer_inc_smpl_lost(void)
{
- struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
+ struct oprofile_cpu_buffer *cpu_buf = this_cpu_ptr(&op_cpu_buffer);

cpu_buf->sample_lost_overflow++;
}
@@ -297,7 +297,7 @@
unsigned long event, int is_kernel,
struct task_struct *task)
{
- struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
+ struct oprofile_cpu_buffer *cpu_buf = this_cpu_ptr(&op_cpu_buffer);
unsigned long backtrace = oprofile_backtrace_depth;

/*
@@ -357,7 +357,7 @@
{
struct op_sample *sample;
int is_kernel = !user_mode(regs);
- struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
+ struct oprofile_cpu_buffer *cpu_buf = this_cpu_ptr(&op_cpu_buffer);

cpu_buf->sample_received++;

@@ -412,13 +412,13 @@

void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event)
{
- struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
+ struct oprofile_cpu_buffer *cpu_buf = this_cpu_ptr(&op_cpu_buffer);
log_sample(cpu_buf, pc, 0, is_kernel, event, NULL);
}

void oprofile_add_trace(unsigned long pc)
{
- struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
+ struct oprofile_cpu_buffer *cpu_buf = this_cpu_ptr(&op_cpu_buffer);

if (!cpu_buf->tracing)
return;
Index: linux/drivers/oprofile/timer_int.c
===================================================================
--- linux.orig/drivers/oprofile/timer_int.c 2014-04-14 13:24:54.801361443 -0500
+++ linux/drivers/oprofile/timer_int.c 2014-04-14 13:24:54.797361519 -0500
@@ -32,7 +32,7 @@

static void __oprofile_hrtimer_start(void *unused)
{
- struct hrtimer *hrtimer = &__get_cpu_var(oprofile_hrtimer);
+ struct hrtimer *hrtimer = this_cpu_ptr(&oprofile_hrtimer);

if (!ctr_running)
return;


2014-07-18 23:28:55

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH 07/31] drivers/oprofile: Replace __get_cpu_var uses for address calculation

On Fri, Jun 20, 2014 at 02:31:22PM -0500, Christoph Lameter wrote:
> Replace the uses of __get_cpu_var for address calculation with this_cpu_ptr.
>
> Cc: Robert Richter <[email protected]>
> Cc: [email protected]
> Signed-off-by: Christoph Lameter <[email protected]>

Applied to wq/for-3.17-consistent-ops. If this patch should be routed
differently, please holler.

Thanks.

--
tejun

2014-07-19 11:54:40

by Robert Richter

[permalink] [raw]
Subject: Re: [PATCH 07/31] drivers/oprofile: Replace __get_cpu_var uses for address calculation

On 18.07.14 19:28:50, Tejun Heo wrote:
> On Fri, Jun 20, 2014 at 02:31:22PM -0500, Christoph Lameter wrote:
> > Replace the uses of __get_cpu_var for address calculation with this_cpu_ptr.
> >
> > Cc: Robert Richter <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Christoph Lameter <[email protected]>
>
> Applied to wq/for-3.17-consistent-ops. If this patch should be routed
> differently, please holler.

Fine with me. Thanks

-Robert