From: "Björn Töpel" <bjorn.topel@intel.com>
To: "Jakub Kicinski" <kuba@kernel.org>,
"Björn Töpel" <bjorn.topel@gmail.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
magnus.karlsson@intel.com, ast@kernel.org, daniel@iogearbox.net,
maciej.fijalkowski@intel.com, sridhar.samudrala@intel.com,
jesse.brandeburg@intel.com, qi.z.zhang@intel.com,
edumazet@google.com, jonathan.lemon@gmail.com,
maximmi@nvidia.com
Subject: Re: [PATCH bpf-next v3 01/10] net: introduce preferred busy-polling
Date: Tue, 24 Nov 2020 08:58:01 +0100 [thread overview]
Message-ID: <0e670f81-e252-2345-60cd-38dea0603021@intel.com> (raw)
In-Reply-To: <20201123160412.1bfb5161@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On 2020-11-24 01:04, Jakub Kicinski wrote:
> On Thu, 19 Nov 2020 09:30:15 +0100 Björn Töpel wrote:
>> + /* The NAPI context has more processing work, but busy-polling
>> + * is preferred. Exit early.
>> + */
>> + if (napi_prefer_busy_poll(n)) {
>> + if (napi_complete_done(n, work)) {
>> + /* If timeout is not set, we need to make sure
>> + * that the NAPI is re-scheduled.
>> + */
>> + napi_schedule(n);
>> + }
>> + goto out_unlock;
>> + }
>
> Do we really need to go through napi_complete_done() here?
>
> Isn't it sufficient to check:
>
> if (napi_prefer_busy_poll(n) &&
> hrtimer_active(&n->timer)) // not 100% sure this is the
> // right helper for the check
>
> If timer is scheduled it will fire and worst case sirq will kick back
> in after timeout. napi_complete_done() should had been called by the
> driver already to schedule the timer. If the driver doesn't call
> napi_complete_done() we should not allow it to use busy_poll() anyway.
>
No, it's not. For a heavy traffic load, the napi_complete_done() will
never be called by the driver. It'll just keep on spinning in the
ksoftirqd. This code is to force out of that loop, so we need to call
napi_complete_done() explicitly (which will set the timeout).
Without the explicit napi_complete_done(), the ksoftirqd will not stop,
and the busy-polling will never allow to enter.
Björn
next prev parent reply other threads:[~2020-11-24 7:58 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 8:30 [PATCH bpf-next v3 00/10] Introduce preferred busy-polling Björn Töpel
2020-11-19 8:30 ` [PATCH bpf-next v3 01/10] net: introduce " Björn Töpel
2020-11-24 0:04 ` Jakub Kicinski
2020-11-24 7:58 ` Björn Töpel [this message]
2020-11-24 0:11 ` Jakub Kicinski
2020-11-24 8:47 ` Björn Töpel
2020-11-24 16:21 ` Jakub Kicinski
2020-11-19 8:30 ` [PATCH bpf-next v3 02/10] net: add SO_BUSY_POLL_BUDGET socket option Björn Töpel
2020-11-24 16:21 ` Jakub Kicinski
2020-11-19 8:30 ` [PATCH bpf-next v3 03/10] xsk: add support for recvmsg() Björn Töpel
2020-11-25 6:55 ` Magnus Karlsson
2020-11-19 8:30 ` [PATCH bpf-next v3 04/10] xsk: check need wakeup flag in sendmsg() Björn Töpel
2020-11-25 7:16 ` Magnus Karlsson
2020-11-19 8:30 ` [PATCH bpf-next v3 05/10] xsk: add busy-poll support for {recv,send}msg() Björn Töpel
2020-11-25 7:58 ` Magnus Karlsson
2020-11-19 8:30 ` [PATCH bpf-next v3 06/10] xsk: propagate napi_id to XDP socket Rx path Björn Töpel
2020-11-19 8:30 ` [Intel-wired-lan] " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-11-25 14:47 ` Magnus Karlsson
2020-11-25 14:47 ` [Intel-wired-lan] " Magnus Karlsson
2020-11-25 21:14 ` Michael S. Tsirkin
2020-11-25 21:14 ` [Intel-wired-lan] " Michael S. Tsirkin
2021-09-29 18:33 ` kernel test robot
2021-09-29 18:33 ` kernel test robot
2021-09-30 6:04 ` Magnus Karlsson
2021-09-30 6:04 ` Magnus Karlsson
2021-10-02 2:07 ` [kbuild-all] " Philip Li
2021-10-02 2:07 ` Philip Li
2021-11-05 20:17 ` kernel test robot
2021-11-05 20:17 ` kernel test robot
2020-11-19 8:30 ` [PATCH bpf-next v3 07/10] samples/bpf: use recvfrom() in xdpsock/rxdrop Björn Töpel
2020-11-25 7:59 ` Magnus Karlsson
2020-11-19 8:30 ` [PATCH bpf-next v3 08/10] samples/bpf: use recvfrom() in xdpsock/l2fwd Björn Töpel
2020-11-25 8:00 ` Magnus Karlsson
2020-11-19 8:30 ` [PATCH bpf-next v3 09/10] samples/bpf: add busy-poll support to xdpsock Björn Töpel
2020-11-25 8:19 ` Magnus Karlsson
2020-11-19 8:30 ` [PATCH bpf-next v3 10/10] samples/bpf: add option to set the busy-poll budget Björn Töpel
2020-11-25 8:23 ` Magnus Karlsson
2020-11-23 13:31 ` [PATCH bpf-next v3 00/10] Introduce preferred busy-polling Björn Töpel
2020-11-23 23:54 ` Jakub Kicinski
2020-11-24 0:14 ` Jakub Kicinski
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=0e670f81-e252-2345-60cd-38dea0603021@intel.com \
--to=bjorn.topel@intel.com \
--cc=ast@kernel.org \
--cc=bjorn.topel@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=edumazet@google.com \
--cc=jesse.brandeburg@intel.com \
--cc=jonathan.lemon@gmail.com \
--cc=kuba@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=qi.z.zhang@intel.com \
--cc=sridhar.samudrala@intel.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 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.