Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1475085

Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in __wait_on_bit_lock()

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in __wait_on_bit_lock()
Date 2016-09-02 14:10 +0200
Message-ID <scVse-7Ky-21@gated-at.bofh.it> (permalink)
References <saoK6-6YC-21@gated-at.bofh.it> <saoK6-6YC-23@gated-at.bofh.it> <scHpf-70l-21@gated-at.bofh.it> <scIuZ-7JZ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] sched/wait: abort_exclusive_wait() should pass  TASK_NORMAL to wake_up() Oleg Nesterov <oleg@redhat.com> - 2016-08-26 15:00 +0200
  [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in  __wait_on_bit_lock() Oleg Nesterov <oleg@redhat.com> - 2016-08-26 15:00 +0200
    Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in  __wait_on_bit_lock() Peter Zijlstra <peterz@infradead.org> - 2016-09-01 23:10 +0200
      Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in         __wait_on_bit_lock() Oleg Nesterov <oleg@redhat.com> - 2016-09-02 14:10 +0200
    Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in  __wait_on_bit_lock() Peter Zijlstra <peterz@infradead.org> - 2016-09-01 23:20 +0200
      Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in  __wait_on_bit_lock() Peter Zijlstra <peterz@infradead.org> - 2016-09-02 00:20 +0200
        Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in         __wait_on_bit_lock() Oleg Nesterov <oleg@redhat.com> - 2016-09-02 14:10 +0200
          Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in  __wait_on_bit_lock() Peter Zijlstra <peterz@infradead.org> - 2016-09-02 15:30 +0200
      Re: [PATCH 2/2] sched/wait: avoid abort_exclusive_wait() in         __wait_on_bit_lock() Oleg Nesterov <oleg@redhat.com> - 2016-09-02 14:10 +0200
  [PATCH 1/2] sched/wait: abort_exclusive_wait() should pass  TASK_NORMAL to wake_up() Oleg Nesterov <oleg@redhat.com> - 2016-08-26 15:00 +0200
    Re: [PATCH 1/2] sched/wait: abort_exclusive_wait() should pass  TASK_NORMAL to wake_up() Peter Zijlstra <peterz@infradead.org> - 2016-09-01 13:40 +0200
      Re: [PATCH 1/2] sched/wait: abort_exclusive_wait() should pass         TASK_NORMAL to wake_up() Oleg Nesterov <oleg@redhat.com> - 2016-09-01 23:10 +0200
        Re: [PATCH 1/2] sched/wait: abort_exclusive_wait() should pass  TASK_NORMAL to wake_up() Peter Zijlstra <peterz@infradead.org> - 2016-09-02 00:50 +0200
  Re: [PATCH 0/2] sched/wait: abort_exclusive_wait() should pass  TASK_NORMAL to wake_up() Peter Zijlstra <peterz@infradead.org> - 2016-09-01 13:10 +0200

csiph-web