[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160902120642.GC26495@redhat.com>
Date: Fri, 2 Sep 2016 14:06:43 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>, Al Viro <viro@...IV.linux.org.uk>,
Bart Van Assche <bvanassche@....org>,
Johannes Weiner <hannes@...xchg.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Neil Brown <neilb@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in
__wait_on_bit_lock()
On 09/02, Peter Zijlstra wrote:
>
> FWIW, the way the mutex code avoids this issue is by doing the
> signal_pending test while holding the q->lock, that way its exclusive
> with wakeup.
And __wait_event_interruptible_locked() too.
BTW it is buggy anyway, it needs the
- __add_wait_queue_tail(&(wq), &__wait);
+ if (exclusive)
+ __add_wait_queue_tail(&(wq), &__wait);
+ else
+ __add_wait_queue((&(wq), &__wait);
and in fact it should use __add_wait_queue_exclusive() so that we
can remove another "if (exclusive)" but this is off-topic.
Yes, I considered this option, but to me the addtional finish_wait()
looks simpler.
And, if you agree with this change I will try to change __wait_event()
as well and kill abort_exclusive_wait().
And in this case we certainly do not want to check the "condition" with
q->lock held, because this would mean that "condition" won't be able to
take this lock.
Oleg.
Powered by blists - more mailing lists