[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0805292309520.12457@schroedinger.engr.sgi.com>
Date: Thu, 29 May 2008 23:12:59 -0700 (PDT)
From: Christoph Lameter <clameter@....com>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: 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>,
Rusty Russell <rusty@...tcorp.com.au>,
Mike Travis <travis@....com>
Subject: Re: [patch 04/41] cpu ops: Core piece for generic atomic per cpu
operations
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. local_t
cannot do that in an atomic (wrt interrupt/preempt fashion) fashion. cpu
ops can use a segment prefix and thus the insructions can calculate the
per cpu adress and perform the atomic inc without disabling preempt or
interrupts.
local_t is only useful when you disable interrupt or premption otherwise.
But then you could also use a regular increment.
> > But then its related to percpu operations and relies extensively on the
> > various percpu.h files in asm-generic and asm-arch and include/linux
>
> Well that should be fixed. We should never have mixed the
> alloc_percpu() and DEFINE_PER_CPU things inthe same header. They're
> different.
With cpu_alloc they are the same. They allocate from the same per cpu
area.
--
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