public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Cc: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>,
	io-uring@vger.kernel.org, joseph.qi@linux.alibaba.com
Subject: Re: [LIBURING PATCH] sq_ring_needs_enter: check whether there are sqes when SQPOLL is not enabled
Date: Mon, 13 Apr 2020 09:59:46 -0600	[thread overview]
Message-ID: <0fba5ff2-5efe-06f5-704b-e8e08346374b@kernel.dk> (raw)
In-Reply-To: <CAEsUgYh9QHgfo2RfnAupOVu+BO5rDnQjU+78SnBTuiHtECHpqQ@mail.gmail.com>

On 4/13/20 9:46 AM, Hrvoje Zeba wrote:
> On Mon, Apr 13, 2020 at 11:29 AM Jens Axboe <axboe@kernel.dk> wrote:
>>
>> On 4/13/20 1:19 AM, Xiaoguang Wang wrote:
>>> Indeed I'm not sure this patch is necessary, robust applications
>>> should not call io_uring_submit when there are not sqes to submmit.
>>> But still try to add this check, I have seen some applications which
>>> call io_uring_submit(), but there are not sqes to submit.
>>
>> Hmm, not sure it's worth complicating the submit path for that case.
>> A high performant application should not call io_uring_submit() if
>> it didn't queue anything new. Is this a common case you've seen?
>>
> 
> My code calls io_uring_submit() even if there are no sqes to submit to
> avoid spinning if there's nothing to do:
> 
> ...
> uint32_t sleep = (gt::user_contexts_waiting() > 0) ? 0 : 1;
> auto res = io_uring_submit_and_wait(&m_io_uring, sleep);

If you're calling with wait, then an sqe will be submitted with a
timeout operation. So that use case is fine. Or waiting in general.
But calling with {0,0} for {submit,wait} would be kind of silly.

-- 
Jens Axboe


  reply	other threads:[~2020-04-13 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13  7:19 [LIBURING PATCH] sq_ring_needs_enter: check whether there are sqes when SQPOLL is not enabled Xiaoguang Wang
2020-04-13 14:18 ` Jens Axboe
2020-04-13 15:46   ` Hrvoje Zeba
2020-04-13 15:59     ` Jens Axboe [this message]
2020-04-13 22:27   ` 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=0fba5ff2-5efe-06f5-704b-e8e08346374b@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=xiaoguang.wang@linux.alibaba.com \
    --cc=zeba.hrvoje@gmail.com \
    /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