All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Jan Kara <jack@suse.cz>
Cc: Josef Bacik <josef@toxicpanda.com>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-block@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] rq-qos: fix missed wake-ups in rq_qos_throttle try two
Date: Tue, 8 Jun 2021 15:13:16 -0600	[thread overview]
Message-ID: <e14aeaa7-45a3-b2f0-7738-3613189ae1d4@kernel.dk> (raw)
In-Reply-To: <20210607112613.25344-1-jack@suse.cz>

On 6/7/21 5:26 AM, Jan Kara wrote:
> Commit 545fbd0775ba ("rq-qos: fix missed wake-ups in rq_qos_throttle")
> tried to fix a problem that a process could be sleeping in rq_qos_wait()
> without anyone to wake it up. However the fix is not complete and the
> following can still happen:
> 
> CPU1 (waiter1)		CPU2 (waiter2)		CPU3 (waker)
> rq_qos_wait()		rq_qos_wait()
>   acquire_inflight_cb() -> fails
> 			  acquire_inflight_cb() -> fails
> 
> 						completes IOs, inflight
> 						  decreased
>   prepare_to_wait_exclusive()
> 			  prepare_to_wait_exclusive()
>   has_sleeper = !wq_has_single_sleeper() -> true as there are two sleepers
> 			  has_sleeper = !wq_has_single_sleeper() -> true
>   io_schedule()		  io_schedule()
> 
> Deadlock as now there's nobody to wakeup the two waiters. The logic
> automatically blocking when there are already sleepers is really subtle
> and the only way to make it work reliably is that we check whether there
> are some waiters in the queue when adding ourselves there. That way, we
> are guaranteed that at least the first process to enter the wait queue
> will recheck the waiting condition before going to sleep and thus
> guarantee forward progress.

Applied, thanks.

-- 
Jens Axboe


      reply	other threads:[~2021-06-08 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 11:26 [PATCH] rq-qos: fix missed wake-ups in rq_qos_throttle try two Jan Kara
2021-06-08 21:13 ` Jens Axboe [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=e14aeaa7-45a3-b2f0-7738-3613189ae1d4@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=jack@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=stable@vger.kernel.org \
    /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.