Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1714734 > unrolled thread
| Started by | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| First post | 2017-08-18 11:10 +0200 |
| Last post | 2017-08-18 11:10 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [patch-rt] locking, rwlock-rt: do not save state multiple times in __write_rt_lock() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2017-08-18 11:10 +0200
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2017-08-18 11:10 +0200 |
| Subject | Re: [patch-rt] locking, rwlock-rt: do not save state multiple times in __write_rt_lock() |
| Message-ID | <ufLs0-1qM-73@gated-at.bofh.it> |
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
Back to top | Article view | linux.kernel
csiph-web