public inbox for [email protected]
 help / color / mirror / Atom feed
From: Hao Xu <[email protected]>
To: Olivier Langlois <[email protected]>,
	Jens Axboe <[email protected]>,
	[email protected]
Subject: Re: napi_busy_poll
Date: Fri, 18 Feb 2022 15:41:41 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>


On 2/18/22 13:05, Olivier Langlois wrote:
> On Wed, 2022-02-16 at 20:14 +0800, Hao Xu wrote:
>> @@ -5583,6 +5650,7 @@ static void io_poll_task_func(struct io_kiocb
>> *req, bool *locked)
>>           struct io_ring_ctx *ctx = req->ctx;
>>           int ret;
>>
>> +       io_add_napi(req->file, req->ctx);
>>           ret = io_poll_check_events(req);
>>           if (ret > 0)
>>                   return;
>> @@ -5608,6 +5676,7 @@ static void io_apoll_task_func(struct io_kiocb
>> *req, bool *locked)
>>           struct io_ring_ctx *ctx = req->ctx;
>>           int ret;
>>
>> +       io_add_napi(req->file, req->ctx);
>>           ret = io_poll_check_events(req);
>>           if (ret > 0)
>>                   return;
>>
> I have a doubt about these call sites for adding the napi_id into the
> list. AFAIK, these are the functions called when the desired events are
> ready therefore, it is too late for polling the device.
[1]
>
> OTOH, my choice of doing it from io_file_get_normal() was perhaps a
> poor choice too because it is premature.
>
> Possibly the best location might be __io_arm_poll_handler()...
Hi Oliver,

Have you tried just issue one recv/pollin request and observe the

napi_id? From my understanding of the network stack, the napi_id

of a socket won't be valid until it gets some packets. Because before

that moment, busy_poll doesn't know which hw queue to poll.

In other words, the idea of NAPI polling is: the packets of a socket

can be from any hw queue of a net adapter, but we just poll the

queue which just received some data. So to get this piece of info,

there must be some data coming to one queue, before doing the

busy_poll. Correct me if I'm wrong since I'm also a newbie of

network stuff...


I was considering to poll all the rx rings, but it seemed to be not

efficient from some tests by my colleague.

for question [1] you mentioned, I think it's ok, since:

  - not all the data has been ready at that moment

  - the polling is not just for that request, there may be more data comming

    from the rx ring since we usually use polling mode under high workload

    pressure.

See the implementation of epoll busy_poll, the same thing.


Regards,
Hao


  reply	other threads:[~2022-02-18  7:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 14:58 napi_busy_poll Olivier Langlois
2022-02-08 17:05 ` napi_busy_poll Jens Axboe
2022-02-09  3:34   ` napi_busy_poll Hao Xu
2022-02-12 19:51     ` napi_busy_poll Olivier Langlois
2022-02-13 18:47       ` napi_busy_poll Jens Axboe
2022-02-14 17:13       ` napi_busy_poll Hao Xu
2022-02-15  8:37         ` napi_busy_poll Olivier Langlois
2022-02-15 18:05           ` napi_busy_poll Olivier Langlois
2022-02-16  3:12             ` napi_busy_poll Hao Xu
2022-02-16 19:19               ` napi_busy_poll Olivier Langlois
2022-02-16 12:14             ` napi_busy_poll Hao Xu
2022-02-17 20:28               ` napi_busy_poll Olivier Langlois
2022-02-18  8:06                 ` napi_busy_poll Hao Xu
2022-02-19  7:14                   ` napi_busy_poll Olivier Langlois
2022-02-21  4:52                     ` napi_busy_poll Hao Xu
2022-02-17 23:18               ` napi_busy_poll Olivier Langlois
2022-02-17 23:25                 ` napi_busy_poll Jens Axboe
2022-02-18  7:21                 ` napi_busy_poll Hao Xu
2022-02-18  5:05               ` napi_busy_poll Olivier Langlois
2022-02-18  7:41                 ` Hao Xu [this message]
2022-02-19  7:02                   ` napi_busy_poll Olivier Langlois
2022-02-21  5:03                     ` napi_busy_poll Hao Xu
2022-02-25  4:42                       ` napi_busy_poll Olivier Langlois

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=44b5cc5e-5417-b766-5d28-15b7bcaaafed@linux.alibaba.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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