lkml.org 
[lkml]   [2008]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux 2.6.25-rc2
On Wed, 27 Feb 2008, Andrew Morton wrote:

> Doing ++ on a u32 _is_ atomic wrt interrupts on x86 and probably lots of
> other architectures, so we're OK using unsigned there. But on some other
> architectures ++ on u32 is not atomic wrt interrutps, so they should use
> atomic_t or some other arch-specific mechanism.
>
> And guess what? It's already all been done: local_t.

local_t requires the disabling of preempt to work right.

The real solution here is cpu_alloc / cpu_ops. Per cpu operations work on
an offset relative to the start of the per process cpu data area in some
register. An increment can then be atomic vs. interrupt because it does
the calculation of the address and the inc in one instruction. F.e.

gs: inc [percpu_offset]

Processor may change before and after without ill effects. So no preempt
since the instruction will always reference the %%gs register that points
to the percpu area of the currently executing processor.


\
 
 \ /
  Last update: 2008-02-28 03:47    [W:0.161 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site