public inbox for [email protected]
 help / color / mirror / Atom feed
From: Stefan Roesch <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected], [email protected],
	[email protected], [email protected], [email protected]
Subject: [PATCH v15 2/7] net: add napi_busy_loop_rcu()
Date: Thu,  8 Jun 2023 09:38:34 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

This adds the napi_busy_loop_rcu() function. This function assumes that
the calling function is already holding the rcu read lock and
napi_busy_loop() does not need to take the rcu read lock.

Signed-off-by: Stefan Roesch <[email protected]>
---
 include/net/busy_poll.h |  4 ++++
 net/core/dev.c          | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
index f90f0021f5f2..622623f5740e 100644
--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -47,6 +47,10 @@ void napi_busy_loop(unsigned int napi_id,
 		    bool (*loop_end)(void *, unsigned long),
 		    void *loop_end_arg, bool prefer_busy_poll, u16 budget);
 
+void napi_busy_loop_rcu(unsigned int napi_id,
+			bool (*loop_end)(void *, unsigned long),
+			void *loop_end_arg, bool prefer_busy_poll, u16 budget);
+
 #else /* CONFIG_NET_RX_BUSY_POLL */
 static inline unsigned long net_busy_loop_on(void)
 {
diff --git a/net/core/dev.c b/net/core/dev.c
index ae90265f4020..60fc54c4aa42 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6260,6 +6260,17 @@ void __napi_busy_loop(unsigned int napi_id,
 		rcu_read_unlock();
 }
 
+/* Warning: can exit without calling need_resched(). */
+void napi_busy_loop_rcu(unsigned int napi_id,
+			bool (*loop_end)(void *, unsigned long),
+			void *loop_end_arg, bool prefer_busy_poll, u16 budget)
+{
+	WARN_ON_ONCE(!rcu_read_lock_held());
+
+	__napi_busy_loop(napi_id, loop_end, loop_end_arg, prefer_busy_poll,
+			 budget, true);
+}
+
 void napi_busy_loop(unsigned int napi_id,
 		    bool (*loop_end)(void *, unsigned long),
 		    void *loop_end_arg, bool prefer_busy_poll, u16 budget)
-- 
2.39.1


  parent reply	other threads:[~2023-06-08 16:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 16:38 [PATCH v15 0/7] io_uring: add napi busy polling support Stefan Roesch
2023-06-08 16:38 ` [PATCH v15 1/7] net: split off __napi_busy_poll from napi_busy_poll Stefan Roesch
2023-06-08 19:33   ` kernel test robot
2023-06-08 16:38 ` Stefan Roesch [this message]
2023-06-08 16:38 ` [PATCH v15 3/7] io-uring: move io_wait_queue definition to header file Stefan Roesch
2023-06-08 16:38 ` [PATCH v15 4/7] io-uring: add napi busy poll support Stefan Roesch
2023-06-08 16:38 ` [PATCH v15 5/7] io-uring: add sqpoll support for napi busy poll Stefan Roesch
2023-06-08 16:38 ` [PATCH v15 6/7] io_uring: add register/unregister napi function Stefan Roesch
2023-06-08 16:38 ` [PATCH v15 7/7] io_uring: add prefer busy poll to register and unregister napi api Stefan Roesch
2024-01-30 21:20 ` [PATCH v15 0/7] io_uring: add napi busy polling support Olivier Langlois
2024-01-30 22:59   ` Jens Axboe
2024-01-31  5:30     ` Olivier Langlois
2024-01-31 17:22     ` Olivier Langlois
2024-01-31 17:32       ` Jens Axboe
2024-01-31 17:59         ` Olivier Langlois
2024-01-31 19:56           ` Olivier Langlois
2024-01-31 20:52             ` Jens Axboe
2024-01-31 21:03               ` Olivier Langlois
2024-02-02 20:20               ` Olivier Langlois
2024-02-02 22:58                 ` 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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [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