All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: RFC: mutex: hung tasks on SMP platforms with asm-generic/mutex-xchg.h
Date: Mon, 13 Aug 2012 10:13:49 +0100	[thread overview]
Message-ID: <20120813091349.GA19113@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1344845704.31459.11.camel@twins>

Hi Peter,

On Mon, Aug 13, 2012 at 09:15:04AM +0100, Peter Zijlstra wrote:
> On Thu, 2012-08-09 at 12:57 -0400, Nicolas Pitre wrote:
> > 
> > In other words, I think this should look like this:
> > 
> > diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
> > index 580a6d35c7..44a66c99c8 100644
> > --- a/include/asm-generic/mutex-xchg.h
> > +++ b/include/asm-generic/mutex-xchg.h
> > @@ -25,8 +25,11 @@
> >  static inline void
> >  __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
> >  {
> > -       if (unlikely(atomic_xchg(count, 0) != 1))
> > -               fail_fn(count);
> > +       if (unlikely(atomic_xchg(count, 0) != 1)) {
> > +               /* Mark lock contention explicitly */
> > +               if (likely(atomic_xchg(count, -1) != 1))
> > +                       fail_fn(count);
> > +       }
> >  } 
> 
> OK, I like this.. Thanks guys! Will will you send a final and complete
> patch?

I sent one out on Friday but somehow managed to drop you from CC -- sorry
about that:

  http://thread.gmane.org/gmane.linux.kernel/1341305

Cheers,

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Nicolas Pitre <nico@fluxnic.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Chris Mason <chris.mason@fusionio.com>,
	Arnd Bergmann <arnd@arndb.de>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: RFC: mutex: hung tasks on SMP platforms with asm-generic/mutex-xchg.h
Date: Mon, 13 Aug 2012 10:13:49 +0100	[thread overview]
Message-ID: <20120813091349.GA19113@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1344845704.31459.11.camel@twins>

Hi Peter,

On Mon, Aug 13, 2012 at 09:15:04AM +0100, Peter Zijlstra wrote:
> On Thu, 2012-08-09 at 12:57 -0400, Nicolas Pitre wrote:
> > 
> > In other words, I think this should look like this:
> > 
> > diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
> > index 580a6d35c7..44a66c99c8 100644
> > --- a/include/asm-generic/mutex-xchg.h
> > +++ b/include/asm-generic/mutex-xchg.h
> > @@ -25,8 +25,11 @@
> >  static inline void
> >  __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
> >  {
> > -       if (unlikely(atomic_xchg(count, 0) != 1))
> > -               fail_fn(count);
> > +       if (unlikely(atomic_xchg(count, 0) != 1)) {
> > +               /* Mark lock contention explicitly */
> > +               if (likely(atomic_xchg(count, -1) != 1))
> > +                       fail_fn(count);
> > +       }
> >  } 
> 
> OK, I like this.. Thanks guys! Will will you send a final and complete
> patch?

I sent one out on Friday but somehow managed to drop you from CC -- sorry
about that:

  http://thread.gmane.org/gmane.linux.kernel/1341305

Cheers,

Will

  reply	other threads:[~2012-08-13  9:13 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 11:56 RFC: mutex: hung tasks on SMP platforms with asm-generic/mutex-xchg.h Will Deacon
2012-08-07 11:56 ` Will Deacon
2012-08-07 13:48 ` Peter Zijlstra
2012-08-07 13:48   ` Peter Zijlstra
2012-08-07 14:04   ` Will Deacon
2012-08-07 14:04     ` Will Deacon
2012-08-07 17:14 ` Nicolas Pitre
2012-08-07 17:14   ` Nicolas Pitre
2012-08-07 17:33   ` Will Deacon
2012-08-07 17:33     ` Will Deacon
2012-08-07 17:38     ` Will Deacon
2012-08-07 17:38       ` Will Deacon
2012-08-07 18:28     ` Nicolas Pitre
2012-08-07 18:28       ` Nicolas Pitre
2012-08-09  5:12 ` Nicolas Pitre
2012-08-09  5:12   ` Nicolas Pitre
2012-08-09 14:49   ` Will Deacon
2012-08-09 14:49     ` Will Deacon
2012-08-09 16:17     ` Nicolas Pitre
2012-08-09 16:17       ` Nicolas Pitre
2012-08-09 16:57       ` Nicolas Pitre
2012-08-09 16:57         ` Nicolas Pitre
2012-08-09 17:50         ` Will Deacon
2012-08-09 17:50           ` Will Deacon
2012-08-09 18:09           ` Nicolas Pitre
2012-08-09 18:09             ` Nicolas Pitre
2012-08-09 18:17             ` Will Deacon
2012-08-09 18:17               ` Will Deacon
2012-08-09 20:05               ` Nicolas Pitre
2012-08-09 20:05                 ` Nicolas Pitre
2012-08-13  8:15         ` Peter Zijlstra
2012-08-13  8:15           ` Peter Zijlstra
2012-08-13  9:13           ` Will Deacon [this message]
2012-08-13  9:13             ` Will Deacon
2012-08-13 13:35           ` Nicolas Pitre
2012-08-13 13:35             ` Nicolas Pitre
2012-08-13 14:05             ` Peter Zijlstra
2012-08-13 14:05               ` Peter Zijlstra
2012-08-13 14:11               ` Will Deacon
2012-08-13 14:11                 ` Will Deacon
2012-08-13 14:45                 ` Peter Zijlstra
2012-08-13 14:45                   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120813091349.GA19113@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.