Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup
From: Darren Hart
Date: Tue Jan 07 2014 - 12:41:52 EST
On Mon, 2014-01-06 at 19:29 -0800, Davidlohr Bueso wrote:
> On Mon, 2014-01-06 at 12:52 -0800, Darren Hart wrote:
> > On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote:
> > I thought someone, Peter Z?, had commented on these CONFIG_SMP bits. Are
> > they really necessary? Does smp_mb__after_atomic_inc() and smp_rmb() not
> > already just do the right thing as far as we're concerned here?
> I don't think so. Thomas and I agreed that this was in fact the way to
> go. I rechecked old email and didn't notice any objections to
> CONFIG_SMP. Also for things like hb_waiters_pending we definitely need
I'll happily defer to Thomas here.
> > Given the subtlety of the implementation - I think it would be good to
> > explicitly annotate the get_futex_key() call site in futex_wake() as
> > providing the MB (B).
> > Similar comment for futex_wait() and futex_requeue() for MB (A).
> > These will also raise the appropriate red flags for people looking to
> > optimize or modify these paths in the future. It would be good to have
> > it in the top level futex_* function to make the MB placement and
> > relationship explicitly clear.
> Something quite similar was already there for v2 but PeterZ's feedback
> made me update the main documentation at the top of futex.c to as it is
I don't want to block this any longer - but as complicated and
non-obvious as this is, I would *MUCH* prefer we document the memory
barrier point in the top level algorithm. If Peter/Thomas/Linus/Ingo
object, so be it, but otherwise let's err on the side of overly explicit
Peter/Thomas/Linus/Ingo: Do any of you object to adding the three memory
barrier comments to the high level functions? futex_wait, futex_wake,
Intel Open Source Technology Center
Yocto Project - Linux Kernel
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/