linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Mike Galbraith <efault@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [patch-rt] locking, rwlock-rt: do not save state multiple times in __write_rt_lock()
Date: Fri, 18 Aug 2017 11:06:27 +0200	[thread overview]
Message-ID: <20170818090626.5u5tm3hakhhntx5y@linutronix.de> (raw)
In-Reply-To: <1502280288.6441.3.camel@gmx.de>

On 2017-08-09 14:04:48 [+0200], Mike Galbraith wrote:
> 
> Save state prior to entering the acquisition loop, otherwise we may
> initially see readers, but upon releasing ->wait_lock see none, loop
> back around, and having not slept, save TASK_UNINTERRUPTIBLE.
> 
> Signed-off-by_ Mike Galbraith <efault@gmx.de>

applied but

> ---
>  kernel/locking/rwlock-rt.c |   37 ++++++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 17 deletions(-)
> 
> --- a/kernel/locking/rwlock-rt.c
> +++ b/kernel/locking/rwlock-rt.c
> @@ -190,30 +190,33 @@ void __sched __write_rt_lock(struct rt_r
>  
> +	for (;;) {
>  		/* Have all readers left the critical region? */
> -		if (!atomic_read(&lock->readers)) {
> -			atomic_set(&lock->readers, WRITER_BIAS);
> -			raw_spin_lock(&self->pi_lock);
> -			__set_current_state_no_track(self->saved_state);
> -			self->saved_state = TASK_RUNNING;
> -			raw_spin_unlock(&self->pi_lock);
> -			raw_spin_unlock_irqrestore(&m->wait_lock, flags);
> -			return;

I kept this part where it is so the diff is smaller.

> -		}
> +		if (!atomic_read(&lock->readers))
> +			break;
>  }
>  
>  int __write_rt_trylock(struct rt_rw_lock *lock)

Sebastian

  reply	other threads:[~2017-08-18  9:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 17:38 [ANNOUNCE] v4.11.12-rt9 Sebastian Andrzej Siewior
2017-08-05  6:13 ` Mike Galbraith
2017-08-05 14:57   ` Mike Galbraith
2017-08-07  7:33     ` Sebastian Andrzej Siewior
2017-08-07  8:22       ` Mike Galbraith
2017-08-08 10:00         ` Mike Galbraith
2017-08-11  7:55           ` [patch-rt] hotplug, hrtimer: Migrate expired/deferred timers during cpu offline Mike Galbraith
2017-08-11  8:15             ` Mike Galbraith
2017-08-14  7:59               ` Mike Galbraith
2017-08-17 16:50                 ` Sebastian Andrzej Siewior
2017-08-17 17:17                   ` Sebastian Andrzej Siewior
2017-08-17 17:26                     ` Mike Galbraith
2017-08-17 17:37                       ` Mike Galbraith
2017-08-17 18:43                     ` Mike Galbraith
2017-08-07  7:52   ` [ANNOUNCE] v4.11.12-rt9 Sebastian Andrzej Siewior
2017-08-07  8:38     ` Mike Galbraith
2017-08-09 12:04       ` [patch-rt] locking, rwlock-rt: do not save state multiple times in __write_rt_lock() Mike Galbraith
2017-08-18  9:06         ` Sebastian Andrzej Siewior [this message]
2017-08-07  9:10     ` [ANNOUNCE] v4.11.12-rt9 Mike Galbraith

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=20170818090626.5u5tm3hakhhntx5y@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).