[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0802271836270.17162@schroedinger.engr.sgi.com>
Date: Wed, 27 Feb 2008 18:43:39 -0800 (PST)
From: Christoph Lameter <clameter@....com>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>,
Pekka Enberg <penberg@...helsinki.fi>,
Torsten Kaiser <just.for.lkml@...glemail.com>,
Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Eric Dumazet <dada1@...mosbay.com>
Subject: Re: 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists