All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH 1/3 v2] wait: introduce wait_event_exclusive_cmd
Date: Thu, 30 Apr 2015 08:17:13 +1000	[thread overview]
Message-ID: <20150430081713.7ad33eb7@notabene.brown> (raw)
In-Reply-To: <20150429093109.GS5029@twins.programming.kicks-ass.net>

[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]

On Wed, 29 Apr 2015 11:31:09 +0200 Peter Zijlstra <peterz@infradead.org>
wrote:

> On Wed, Apr 29, 2015 at 10:48:53AM +0800, Yuanhan Liu wrote:
> > It's just a variant of wait_event_cmd(), with exclusive flag being set.
> > 
> > For cases like RAID5, which puts many processes to sleep until 1/4
> > resources are free, a wake_up wakes up all processes to run, but
> > there is one process being able to get the resource as it's protected
> > by a spin lock. That ends up introducing heavy lock contentions, and
> > hurts performance badly.
> > 
> > Here introduce wait_event_exclusive_cmd to relieve the lock contention
> > naturally by letting wake_up just wake up one process.
> > 
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> 
> Thanks!
> 
> Assuming you want to route this through Neil's MD tree:
> 
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Thanks a lot Peter!

I've queued the three patches in my md tree for 4.2.

Thanks yliu!

NeilBrown


> 
> > ---
> >  include/linux/wait.h | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/include/linux/wait.h b/include/linux/wait.h
> > index 2db8334..db78c72 100644
> > --- a/include/linux/wait.h
> > +++ b/include/linux/wait.h
> > @@ -358,6 +358,19 @@ do {									\
> >  	__ret;								\
> >  })
> >  
> > +#define __wait_event_exclusive_cmd(wq, condition, cmd1, cmd2)		\
> > +	(void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 1, 0,	\
> > +			    cmd1; schedule(); cmd2)
> > +/*
> > + * Just like wait_event_cmd(), except it sets exclusive flag
> > + */
> > +#define wait_event_exclusive_cmd(wq, condition, cmd1, cmd2)		\
> > +do {									\
> > +	if (condition)							\
> > +		break;							\
> > +	__wait_event_exclusive_cmd(wq, condition, cmd1, cmd2);		\
> > +} while (0)
> > +
> >  #define __wait_event_cmd(wq, condition, cmd1, cmd2)			\
> >  	(void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0,	\
> >  			    cmd1; schedule(); cmd2)
> > -- 
> > 1.9.0
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

      reply	other threads:[~2015-04-29 22:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29  2:48 [PATCH 1/3 v2] wait: introduce wait_event_exclusive_cmd Yuanhan Liu
2015-04-29  2:48 ` [PATCH 2/3] md/raid5: split wait_for_stripe and introduce wait_for_quiescent Yuanhan Liu
2015-04-29  2:48 ` [PATCH 3/3] md/raid5: per hash value and exclusive wait_for_stripe Yuanhan Liu
2015-04-29  2:48   ` Yuanhan Liu
2015-05-14  5:45   ` NeilBrown
2015-05-14  5:55     ` Yuanhan Liu
2015-05-14  6:09       ` NeilBrown
2015-04-29  9:31 ` [PATCH 1/3 v2] wait: introduce wait_event_exclusive_cmd Peter Zijlstra
2015-04-29 22:17   ` NeilBrown [this message]

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=20150430081713.7ad33eb7@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yuanhan.liu@linux.intel.com \
    /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.