lkml.org 
[lkml]   [2014]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/1] doc: Add remote CPU access details and others to this_cpu_ops.txt
On 07/17/2014 11:19 AM, Christoph Lameter wrote:
> Regarding atomic_t in per cpu areas: I am uncomfortable especially
> because both locked and unlocked RMW write operations could be acting on
> values in the same cacheline. I am concerned that the unlocked operation
> could have an unpredictable result.
>
>
> f.e. the following per cpu data structure
>
> struct test {
> atomic_t a;
> int b;
> } onecacheline;
>
>
> Local cpu does
>
> this_cpu_inc(onecacheline.b);
>
> If this is racing with a remote cpus:
>
> atomic_inc(percpu(&a, cpu))
>
> then we have on x86 a increment operation with locked semantics racing
> with an unlocked one on the same cacheline.
>

OK, I will add this as a warning in the documentation. Thanks!

--
Pranith


\
 
 \ /
  Last update: 2014-07-18 02:21    [W:0.431 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site