All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jackie Liu <liuyun01@kylinos.cn>
To: Jens Axboe <axboe@kernel.dk>
Cc: Jeff Moyer <jmoyer@redhat.com>, linux-block@vger.kernel.org
Subject: Re: [PATCH] io_uring: ensure cq_entries is at least equal to or greater than sq_entries
Date: Thu, 24 Oct 2019 08:22:56 +0800	[thread overview]
Message-ID: <BB26710D-8704-4D15-9B33-080B28B7941B@kylinos.cn> (raw)
In-Reply-To: <e167ef28-8763-7629-fb5b-e0ef28ed8a49@kernel.dk>



> 2019年10月24日 03:41,Jens Axboe <axboe@kernel.dk> 写道:
> 
> On 10/23/19 12:42 PM, Jeff Moyer wrote:
>> Jackie Liu <liuyun01@kylinos.cn> writes:
>> 
>>> If cq_entries is smaller than sq_entries, it will cause a lot of overflow
>>> to appear. when customizing cq_entries, at least let him be no smaller than
>>> sq_entries.
>>> 
>>> Fixes: 95d8765bd9f2 ("io_uring: allow application controlled CQ ring size")
>>> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
>>> ---
>>>  fs/io_uring.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>>> index b64cd2c..dfa9731 100644
>>> --- a/fs/io_uring.c
>>> +++ b/fs/io_uring.c
>>> @@ -3784,7 +3784,7 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p)
>>>  		 * to a power-of-two, if it isn't already. We do NOT impose
>>>  		 * any cq vs sq ring sizing.
>>>  		 */
>>> -		if (!p->cq_entries || p->cq_entries > IORING_MAX_CQ_ENTRIES)
>>> +		if (p->cq_entries < p->sq_entries || p->cq_entries > IORING_MAX_CQ_ENTRIES)
>> 
>> What if they're both zero?  I think you want to keep that check.
> 
> sq_entries being zero is already checked and failed at this point.
> So I think the patch looks fine from that perspective.
> 
> Is there really a strong reason to disallow this? Yes, it could
> cause overflows, but it's just doing what was asked for. The
> normal case is of course cq_entries being much larger than
> sq_entries.
> 

There are actually no other stronger reasons. I think it would be better to do a
print job in liburing, but the kernel should still make a limit. Too many overflows
will cause less efficiency.

--
Jackie Liu




  reply	other threads:[~2019-10-24  0:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23  1:57 [PATCH] io_uring: ensure cq_entries is at least equal to or greater than sq_entries Jackie Liu
2019-10-23 18:42 ` Jeff Moyer
2019-10-23 19:41   ` Jens Axboe
2019-10-24  0:22     ` Jackie Liu [this message]
2019-10-24  3:26       ` 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=BB26710D-8704-4D15-9B33-080B28B7941B@kylinos.cn \
    --to=liuyun01@kylinos.cn \
    --cc=axboe@kernel.dk \
    --cc=jmoyer@redhat.com \
    --cc=linux-block@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.