linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] blk-mq: skip hybrid polling if iopoll doesn't spin
@ 2020-12-06 14:04 Pavel Begunkov
  2020-12-07 23:49 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2020-12-06 14:04 UTC (permalink / raw)
  To: Jens Axboe, linux-block

If blk_poll() is not going to spin (i.e. @spin=false), it also must not
sleep in hybrid polling, otherwise it might be pretty suprising for
users trying to do a quick check and expecting no-wait behaviour.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---

v2: inverse invalid spin check
v3: add comments, reword and resend

 block/blk-mq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index e9799fed98c7..8d81fe0d8fbc 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3865,9 +3865,10 @@ int blk_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
 	 * the state. Like for the other success return cases, the
 	 * caller is responsible for checking if the IO completed. If
 	 * the IO isn't complete, we'll get called again and will go
-	 * straight to the busy poll loop.
+	 * straight to the busy poll loop. If specified not to spin,
+	 * we also should not sleep.
 	 */
-	if (blk_mq_poll_hybrid(q, hctx, cookie))
+	if (spin && blk_mq_poll_hybrid(q, hctx, cookie))
 		return 1;
 
 	hctx->poll_considered++;
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] blk-mq: skip hybrid polling if iopoll doesn't spin
  2020-12-06 14:04 [PATCH v3] blk-mq: skip hybrid polling if iopoll doesn't spin Pavel Begunkov
@ 2020-12-07 23:49 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-12-07 23:49 UTC (permalink / raw)
  To: Pavel Begunkov, linux-block

On 12/6/20 7:04 AM, Pavel Begunkov wrote:
> If blk_poll() is not going to spin (i.e. @spin=false), it also must not
> sleep in hybrid polling, otherwise it might be pretty suprising for
> users trying to do a quick check and expecting no-wait behaviour.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-07 23:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 14:04 [PATCH v3] blk-mq: skip hybrid polling if iopoll doesn't spin Pavel Begunkov
2020-12-07 23:49 ` Jens Axboe

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).