public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Hao Xu <haoxu@linux.alibaba.com>
To: Olivier Langlois <olivier@trillion01.com>,
	Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>
Cc: io-uring <io-uring@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/2] io_uring: Add support for napi_busy_poll
Date: Wed, 2 Mar 2022 14:35:33 +0800	[thread overview]
Message-ID: <970e752b-aa75-8f66-ae7a-65ab509bea10@linux.alibaba.com> (raw)
In-Reply-To: <d5c162c93cf269d2f94cd0ae8c5d9cd0cd55c265.camel@trillion01.com>


On 3/2/22 13:12, Olivier Langlois wrote:
> On Wed, 2022-03-02 at 02:31 +0800, Hao Xu wrote:
>>> +static void io_blocking_napi_busy_loop(struct list_head
>>> *napi_list,
>>> +                                      struct io_wait_queue *iowq)
>>> +{
>>> +       unsigned long start_time =
>>> +               list_is_singular(napi_list) ? 0 :
>>> +               busy_loop_current_time();
>>> +
>>> +       do {
>>> +               if (list_is_singular(napi_list)) {
>>> +                       struct napi_entry *ne =
>>> +                               list_first_entry(napi_list,
>>> +                                                struct napi_entry,
>>> list);
>>> +
>>> +                       napi_busy_loop(ne->napi_id,
>>> io_busy_loop_end, iowq,
>>> +                                      true, BUSY_POLL_BUDGET);
>>> +                       io_check_napi_entry_timeout(ne);
>>> +                       break;
>>> +               }
>>> +       } while (io_napi_busy_loop(napi_list) &&
>>> +                !io_busy_loop_end(iowq, start_time));
>>> +}
>>> +
>> How about:
>>
>> if (list is singular) {
>>
>>       do something;
>>
>>       return;
>>
>> }
>>
>> while (!io_busy_loop_end() && io_napi_busy_loop())
>>
>>       ;
>>
>>
>> Btw, start_time seems not used in singular branch.
> Hao,
>
> it takes me few readings before being able to figure out the idea
> behind your suggestions. Sorry about that!
>
> So, if I get it correctly, you are proposing extract out the singular
> block out of the while loop...
>
> IMHO, this is not a good idea because you could start iterating the
> do/while loop with a multiple entries list that ends up becoming a
> singular list after one or few iterations.
My bad, I get your point now.
>
> Check what io_napi_busy_loop() is doing...
>
> It does not look like that but a lot thoughts have been put into
> writing io_blocking_napi_busy_loop()...
True.

      reply	other threads:[~2022-03-02  6:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 13:47 [PATCH v4 0/2] io_uring: Add support for napi_busy_poll Olivier Langlois
2022-03-01 13:47 ` [PATCH v4 1/2] io_uring: minor io_cqring_wait() optimization Olivier Langlois
2022-03-01 13:47 ` [PATCH v4 2/2] io_uring: Add support for napi_busy_poll Olivier Langlois
2022-03-01 18:31   ` Hao Xu
2022-03-01 20:06     ` Olivier Langlois
2022-03-01 20:14       ` Olivier Langlois
2022-03-02  6:27       ` Hao Xu
2022-03-02  6:38         ` Hao Xu
2022-03-02 22:03           ` Olivier Langlois
2022-03-03  7:12             ` Hao Xu
2022-03-02  5:12     ` Olivier Langlois
2022-03-02  6:35       ` Hao Xu [this message]

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=970e752b-aa75-8f66-ae7a-65ab509bea10@linux.alibaba.com \
    --to=haoxu@linux.alibaba.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olivier@trillion01.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