public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: don't ignore REQ_NOWAIT for direct IO
Date: Fri, 2 Apr 2021 15:24:11 +0100	[thread overview]
Message-ID: <f94b2905-7356-ca9e-6669-ffb98ae3be19@gmail.com> (raw)
In-Reply-To: <389a12f6-729e-327f-bef9-e3691ef4f78a@kernel.dk>

On 20/11/2020 19:13, Jens Axboe wrote:
> On 11/20/20 10:10 AM, Pavel Begunkov wrote:
>> io_uring's direct nowait requests end up waiting on io_schedule() in
>> sbitmap, that's seems to be so because blkdev_direct_IO() fails to
>> propagate IOCB_NOWAIT to a bio and hence to blk-mq.
>>
>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>> ---
>>  fs/block_dev.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/fs/block_dev.c b/fs/block_dev.c
>> index 9e84b1928b94..e7e860c78d93 100644
>> --- a/fs/block_dev.c
>> +++ b/fs/block_dev.c
>> @@ -263,6 +263,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
>>  		bio.bi_opf = dio_bio_write_op(iocb);
>>  		task_io_account_write(ret);
>>  	}
>> +	if (iocb->ki_flags & IOCB_NOWAIT)
>> +		bio.bi_opf |= REQ_NOWAIT;
>>  	if (iocb->ki_flags & IOCB_HIPRI)
>>  		bio_set_polled(&bio, iocb);
> 
> Was thinking this wasn't needed, but I guess that users could do sync && NOWAIT
> and get -EAGAIN if using preadv2/pwritev2.
> 
>> @@ -416,6 +418,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
>>  			bio->bi_opf = dio_bio_write_op(iocb);
>>  			task_io_account_write(bio->bi_iter.bi_size);
>>  		}
>> +		if (iocb->ki_flags & IOCB_NOWAIT)
>> +			bio->bi_opf |= REQ_NOWAIT;
>>  
>>  		dio->size += bio->bi_iter.bi_size;
>>  		pos += bio->bi_iter.bi_size;
> 
> Looks fine to me, we definitely should not be waiting on tags for IOCB_NOWAIT
> IO. Will run some shakedown and test for 5.11.
> 

up

-- 
Pavel Begunkov

  reply	other threads:[~2021-04-02 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 17:10 [PATCH] block: don't ignore REQ_NOWAIT for direct IO Pavel Begunkov
2020-11-20 17:13 ` Pavel Begunkov
2020-11-20 19:13 ` Jens Axboe
2021-04-02 14:24   ` Pavel Begunkov [this message]
2021-04-02 14:34 ` Jens Axboe

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=f94b2905-7356-ca9e-6669-ffb98ae3be19@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox