lkml.org 
[lkml]   [2011]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1 of 6] x86, UV: smp_processor_id in a preemptable region
On 06/15/2011 09:40 AM, Cliff Wickman wrote:
>
> So would you say I should really widen the scope of the non-preemptible
> region to include everything done with the results of that call to
> smp_processor_id()?
> Which in this case is the call to parse_tunables_write().
> Like this:
>
> preempt_disable();
> bcp = &per_cpu(bau_control, smp_processor_id());
>
> ret = parse_tunables_write(bcp, instr, count);
> preempt_enable_no_resched();
>

Funny enough, this is such a common pattern that we have helpers for it.
We call this get_cpu() ... put_cpu().

-hpa



\
 
 \ /
  Last update: 2011-06-15 19:25    [W:0.038 / U:2.332 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site