From: Stanislav Fomichev <stfomichev@gmail.com>
To: Samiullah Khawaja <skhawaja@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
"David S . Miller " <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
almasrymina@google.com, willemb@google.com,
mkarsten@uwaterloo.ca, Joe Damato <joe@dama.to>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v7 1/2] Extend napi threaded polling to allow kthread based busy polling
Date: Mon, 25 Aug 2025 12:47:27 -0700 [thread overview]
Message-ID: <aKy9z1oephUbAr_E@mini-arch> (raw)
In-Reply-To: <20250824215418.257588-2-skhawaja@google.com>
On 08/24, Samiullah Khawaja wrote:
> Add a new state to napi state enum:
>
> - NAPI_STATE_THREADED_BUSY_POLL
> Threaded busy poll is enabled/running for this napi.
>
> Following changes are introduced in the napi scheduling and state logic:
>
> - When threaded busy poll is enabled through sysfs or netlink it also
> enables NAPI_STATE_THREADED so a kthread is created per napi. It also
> sets NAPI_STATE_THREADED_BUSY_POLL bit on each napi to indicate that
> it is going to busy poll the napi.
>
> - When napi is scheduled with NAPI_STATE_SCHED_THREADED and associated
> kthread is woken up, the kthread owns the context. If
> NAPI_STATE_THREADED_BUSY_POLL and NAPI_STATE_SCHED_THREADED both are
> set then it means that kthread can busy poll.
>
> - To keep busy polling and to avoid scheduling of the interrupts, the
> napi_complete_done returns false when both NAPI_STATE_SCHED_THREADED
> and NAPI_STATE_THREADED_BUSY_POLL flags are set. Also
> napi_complete_done returns early to avoid the
> NAPI_STATE_SCHED_THREADED being unset.
>
> - If at any point NAPI_STATE_THREADED_BUSY_POLL is unset, the
> napi_complete_done will run and unset the NAPI_STATE_SCHED_THREADED
> bit also. This will make the associated kthread go to sleep as per
> existing logic.
>
> Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
>
> ---
> Documentation/ABI/testing/sysfs-class-net | 3 +-
> Documentation/netlink/specs/netdev.yaml | 5 +-
> Documentation/networking/napi.rst | 63 +++++++++++++++++++++-
> include/linux/netdevice.h | 11 +++-
> include/uapi/linux/netdev.h | 1 +
> net/core/dev.c | 66 +++++++++++++++++++----
> net/core/dev.h | 3 ++
> net/core/net-sysfs.c | 2 +-
> net/core/netdev-genl-gen.c | 2 +-
> tools/include/uapi/linux/netdev.h | 1 +
> 10 files changed, 142 insertions(+), 15 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-class-net b/Documentation/ABI/testing/sysfs-class-net
> index ebf21beba846..15d7d36a8294 100644
> --- a/Documentation/ABI/testing/sysfs-class-net
> +++ b/Documentation/ABI/testing/sysfs-class-net
> @@ -343,7 +343,7 @@ Date: Jan 2021
> KernelVersion: 5.12
> Contact: netdev@vger.kernel.org
> Description:
> - Boolean value to control the threaded mode per device. User could
> + Integer value to control the threaded mode per device. User could
> set this value to enable/disable threaded mode for all napi
> belonging to this device, without the need to do device up/down.
>
> @@ -351,4 +351,5 @@ Description:
> == ==================================
> 0 threaded mode disabled for this dev
> 1 threaded mode enabled for this dev
> + 2 threaded mode enabled, and busy polling enabled.
I might have asked already but forgot the answer: any reason we keep
extending sysfs? With a proper ynl control over per-queue settings,
why do we want an option to enable busy-polling threaded mode for the
whole device?
next prev parent reply other threads:[~2025-08-25 19:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-24 21:54 [PATCH net-next v7 0/2] Add support to do threaded napi busy poll Samiullah Khawaja
2025-08-24 21:54 ` [PATCH net-next v7 1/2] Extend napi threaded polling to allow kthread based busy polling Samiullah Khawaja
2025-08-25 19:47 ` Stanislav Fomichev [this message]
2025-08-25 23:11 ` Samiullah Khawaja
2025-08-24 21:54 ` [PATCH net-next v7 2/2] selftests: Add napi threaded busy poll test in `busy_poller` Samiullah Khawaja
2025-08-25 16:30 ` Jakub Kicinski
2025-08-25 17:20 ` Samiullah Khawaja
2025-08-25 0:03 ` [PATCH net-next v7 0/2] Add support to do threaded napi busy poll Martin Karsten
2025-08-25 17:20 ` Samiullah Khawaja
2025-08-25 17:40 ` Martin Karsten
2025-08-25 18:53 ` Samiullah Khawaja
2025-08-25 19:45 ` Martin Karsten
2025-08-25 20:21 ` Martin Karsten
2025-08-28 22:23 ` Samiullah Khawaja
2025-08-25 19:37 ` Stanislav Fomichev
2025-08-25 22:12 ` Samiullah Khawaja
2025-08-25 22:42 ` Stanislav Fomichev
2025-08-25 23:22 ` Samiullah Khawaja
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=aKy9z1oephUbAr_E@mini-arch \
--to=stfomichev@gmail.com \
--cc=almasrymina@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joe@dama.to \
--cc=kuba@kernel.org \
--cc=mkarsten@uwaterloo.ca \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=skhawaja@google.com \
--cc=willemb@google.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;
as well as URLs for NNTP newsgroup(s).