Re: [patch 04/41] cpu ops: Core piece for generic atomic per cpuoperations

From: Andrew Morton
Date: Fri May 30 2008 - 01:38:51 EST


On Thu, 29 May 2008 22:17:55 -0700 (PDT) Christoph Lameter <clameter@xxxxxxx> wrote:

> > > local_t is also very specific to the x86 processor.
> >
> > And alpha, m32r, mips and powerpc, methinks. Probably others, but
> > people just haven't got around to it.
>
> No local_t does not do the relocation of the address to the correct percpu
> 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.

> > I think I'll need to come back another time to understand all that ;)
> >
> > Thanks for writing it up carefully.
>
> Well this stuff is so large in scope that I have difficulties keeping
> everything straight.
>
> > I wonder if all this stuff should be in a new header file.
> >
> > We could get lazy and include that header from percpu.h if needed.
>
> 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.

otoh as you propose removing the old alloc_percpu() I guess the end
result is no worse than what we presently have.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/