io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Andres Freund <andres@anarazel.de>
Cc: io-uring@vger.kernel.org
Subject: Re: Buffered IO async context overhead
Date: Fri, 14 Feb 2020 13:49:31 -0700	[thread overview]
Message-ID: <4896063a-20d7-d2dd-c75e-a082edd5d72f@kernel.dk> (raw)
In-Reply-To: <20200214203140.ksvbm5no654gy7yi@alap3.anarazel.de>

On 2/14/20 1:31 PM, Andres Freund wrote:
> Hi,
> 
> On 2020-02-14 13:13:35 -0700, Jens Axboe wrote:
>> On 2/14/20 12:50 PM, Andres Freund wrote:
>>> which I think is pretty clear evidence we're hitting fairly significant
>>> contention on the queue lock.
>>>
>>>
>>> I am hitting this in postgres originally, not fio, but I thought it's
>>> easier to reproduce this way.  There's obviously benefit to doing things
>>> in the background - but it requires odd logic around deciding when to
>>> use io_uring, and when not.
>>>
>>> To be clear, none of this happens with DIO, but I don't forsee switching
>>> to DIO for all IO by default ever (too high demands on accurate
>>> configuration).
>>
>> Can you try with this added?
>>
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index 76cbf474c184..207daf83f209 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -620,6 +620,7 @@ static const struct io_op_def io_op_defs[] = {
>>  		.async_ctx		= 1,
>>  		.needs_mm		= 1,
>>  		.needs_file		= 1,
>> +		.hash_reg_file		= 1,
>>  		.unbound_nonreg_file	= 1,
>>  	},
>>  	[IORING_OP_WRITEV] = {
>> @@ -634,6 +635,7 @@ static const struct io_op_def io_op_defs[] = {
>>  	},
>>  	[IORING_OP_READ_FIXED] = {
>>  		.needs_file		= 1,
>> +		.hash_reg_file		= 1,
>>  		.unbound_nonreg_file	= 1,
>>  	},
>>  	[IORING_OP_WRITE_FIXED] = {
>> @@ -711,11 +713,13 @@ static const struct io_op_def io_op_defs[] = {
>>  	[IORING_OP_READ] = {
>>  		.needs_mm		= 1,
>>  		.needs_file		= 1,
>> +		.hash_reg_file		= 1,
>>  		.unbound_nonreg_file	= 1,
>>  	},
>>  	[IORING_OP_WRITE] = {
>>  		.needs_mm		= 1,
>>  		.needs_file		= 1,
>> +		.hash_reg_file		= 1,
>>  		.unbound_nonreg_file	= 1,
>>  	},
>>  	[IORING_OP_FADVISE] = {
>> @@ -955,7 +959,7 @@ static inline bool io_prep_async_work(struct io_kiocb *req,
>>  	bool do_hashed = false;
>>  
>>  	if (req->flags & REQ_F_ISREG) {
>> -		if (def->hash_reg_file)
>> +		if (!(req->kiocb->ki_flags & IOCB_DIRECT) && def->hash_reg_file)
>>  			do_hashed = true;
>>  	} else {
>>  		if (def->unbound_nonreg_file)
> 
> I can (will do Sunday, on the road till then). But I'm a bit doubtful
> it'll help. This is using WRITEV after all, and I only see a single
> worker?

Because I'm working on other items, I didn't read carefully enough. Yes
this won't change the situation for writes. I'll take a look at this when
I get time, maybe there's something we can do to improve the situation.

-- 
Jens Axboe


  reply	other threads:[~2020-02-14 20:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 19:50 Buffered IO async context overhead Andres Freund
2020-02-14 20:13 ` Jens Axboe
2020-02-14 20:31   ` Andres Freund
2020-02-14 20:49     ` Jens Axboe [this message]
2020-02-24  9:35       ` Andres Freund
2020-02-24 15:22         ` Jens Axboe
2020-03-09 20:03           ` Pavel Begunkov
2020-03-09 20:41             ` Jens Axboe
2020-03-09 21:02               ` Pavel Begunkov
2020-03-09 21:29                 ` 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=4896063a-20d7-d2dd-c75e-a082edd5d72f@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=andres@anarazel.de \
    --cc=io-uring@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;
as well as URLs for NNTP newsgroup(s).