lkml.org 
[lkml]   [2008]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch 04/41] cpu ops: Core piece for generic atomic per cpu operations
Date
On Friday 30 May 2008 16:12:59 Christoph Lameter wrote:
> On Thu, 29 May 2008, Andrew Morton wrote:
> > > area. It requies disabling of interrupts etc.
> >
> > No it doesn't. Look:
> >
> > static inline void local_inc(local_t *l)
> > {
> > asm volatile(_ASM_INC "%0"
> >
> > : "+m" (l->a.counter));
> >
> > }
> >
> > > Its not atomic (wrt
> > > interrupts) because of that.
> >
> > Yes it is.
>
> No its not! In order to increment a per cpu value you need to calculate
> the per cpu pointer address in the current per cpu segment.

Christoph, you just missed it, that's all. Look at cpu_local_read et al in
include/asm-i386/local.h (ie. before the x86 mergers chose the lowest common
denominator one).

Cheers,
Rusty.


\
 
 \ /
  Last update: 2008-05-30 09:13    [W:0.850 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site