[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0806091605490.9534@schroedinger.engr.sgi.com>
Date: Mon, 9 Jun 2008 16:09:25 -0700 (PDT)
From: Christoph Lameter <clameter@....com>
To: Mike Travis <travis@....com>
cc: Rusty Russell <rusty@...tcorp.com.au>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
David Miller <davem@...emloft.net>,
Eric Dumazet <dada1@...mosbay.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [patch 04/41] cpu ops: Core piece for generic atomic per cpu
operations
On Wed, 4 Jun 2008, Mike Travis wrote:
> 0000000000000013 <test_local_inc>:
> 13: 55 push %rbp
> 14: 65 48 8b 05 00 00 00 mov %gs:0(%rip),%rax # 1c <test_local_inc+0x9>
> 1b: 00
> 1c: 48 89 e5 mov %rsp,%rbp
> 1f: 48 ff 04 07 incq (%rdi,%rax,1)
> 23: c9 leaveq
> 24: c3 retq
Note also that the address calculation occurs before the incq. That is why
disabling preemption is required otherwise the processor may change
between the determination of the per cpu area address and the increment.
The local_t operations could be modified to avoid the preemption issues
with the zero based patches applied. Then there would still be the
inflexbility of not being able to increment an arbitrary variable.
I think it is also bad to treat a per cpu variable like an atomic. Its not
truly atomic nor are strictly atomic accesses used. It is fine to use
regular operations on the per cpu variable provided one has either
disabled preemption or interrupts. The per cpu atomic wrt interrupt ops
are only useful when preemption and/or interrupts are off.
--
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