Re: [PATCH -rt 4/5] use migrate_disable for __local_begin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2007-07-14 at 14:35 -0400, Mathieu Desnoyers wrote:
> * Peter Zijlstra ([email protected]) wrote:
> > On Sat, 2007-07-14 at 13:16 -0400, Mathieu Desnoyers wrote:
> > > * Peter Zijlstra ([email protected]) wrote:
> > > > Signed-off-by: Peter Zijlstra <[email protected]>
> > > > ---
> > > >  include/asm-i386/local.h   |    7 ++++---
> > > >  include/asm-x86_64/local.h |    7 ++++---
> > > >  2 files changed, 8 insertions(+), 6 deletions(-)
> > > > 
> > > > Index: linux-2.6/include/asm-i386/local.h
> > > > ===================================================================
> > > > --- linux-2.6.orig/include/asm-i386/local.h
> > > > +++ linux-2.6/include/asm-i386/local.h
> > > > @@ -197,11 +197,12 @@ static __inline__ long local_sub_return(
> > > >  #define __local_begin(__flags)					\
> > > >  {								\
> > > >  	(__flags) = 0;						\
> > > > -	preempt_disable();					\
> > > > +	migrate_disable();					\
> > > 
> > > Brrrr. That's wrong. Your non atomic __local*() updates only makes sense
> > > when preempt_disable/enable() protects them from concurrent threads on
> > > the same CPU, which is not the case of migrate_disable/enable(). This is
> > > why I suggest that you use local_begin/end() mapped to
> > > migrate_disable/enable() for normal local variables, and, if you really
> > > want a __local_begin/end(), then it should be mapped to
> > > preempt_disable/enable() and should state that it provides no protection
> > > against interrupts.
> > 
> > Sure, but on -rt it does suffice, this part of the patch is rather WIP.
> > 
> > 
> 
> Hrm, how can it suffice, I wonder ? migrate_disable() does not protect
> against other threads on the same CPU, so you could suffer from
> concurrent updates to the same variables. How is it different in -rt ?

I thought the idea was that all these local_* operation were atomic wrt
to the local cpu.

The only difference with -rt is that we generally don't care about
interrupts.

Anyway, I'm dropping all this local stuff, and just hard code it right
into slub.c



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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux