All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Stefan Roesch <shr@devkernel.io>
Cc: io-uring@vger.kernel.org, kernel-team@fb.com, axboe@kernel.dk,
	ammarfaizi2@gnuweeb.org, netdev@vger.kernel.org, kuba@kernel.org,
	olivier@trillion01.com
Subject: Re: [PATCH v14 2/8] net: introduce napi_busy_loop_rcu()
Date: Tue, 6 Jun 2023 12:10:51 +0200	[thread overview]
Message-ID: <ZH8GK0SIMEnAzUzc@corigine.com> (raw)
In-Reply-To: <20230605212009.1992313-3-shr@devkernel.io>

On Mon, Jun 05, 2023 at 02:20:03PM -0700, Stefan Roesch wrote:
> This introduces the napi_busy_loop_rcu() function. If the caller of
> napi_busy_loop() function is also taking the rcu read lock, it is possible
> that napi_busy_loop() is releasing the read lock if it invokes schedule.
> However the caller is expecting that the rcu read lock is not released
> until the function completes. This new function avoids that problem. It
> expects that the caller MUST hold the rcu_read_lock while calling this
> function.
> 
> Signed-off-by: Stefan Roesch <shr@devkernel.io>

Hi Stefan,

some minor nits from my side, which you may
want to consider if you need to spin a v15 for some reason.

...

> diff --git a/net/core/dev.c b/net/core/dev.c
> index f4677aa20f84..fcd4a6a70646 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -6213,6 +6213,37 @@ static inline void __napi_busy_poll(struct napi_busy_poll_ctx *ctx,
>  				LINUX_MIB_BUSYPOLLRXPACKETS, work);
>  	local_bh_enable();
>  }
> +
> +/*
> + * Warning: can exit without calling need_resched().
> + */

For historical reasons, multi-line comments in Networking code are like
this.

/* Something
 * more
 */

Though I notice that dev.c doesn't follow this too closely,
perhaps for other historical reasons.

Anyway, in this case I'd suggest a single like comment.
Unless there is something more to say.

/* 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)

The indentation of the above two likes should align with the inside
of the opening parentheses.

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)

...

  reply	other threads:[~2023-06-06 10:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 21:20 [PATCH v14 0/8] io_uring: add napi busy polling support Stefan Roesch
2023-06-05 21:20 ` [PATCH v14 1/8] net: split off __napi_busy_poll from napi_busy_poll Stefan Roesch
2023-06-05 21:20 ` [PATCH v14 2/8] net: introduce napi_busy_loop_rcu() Stefan Roesch
2023-06-06 10:10   ` Simon Horman [this message]
2023-06-05 21:20 ` [PATCH v14 3/8] net: split off _napi_busy_loop() Stefan Roesch
2023-06-05 22:21   ` Jakub Kicinski
2023-06-05 21:20 ` [PATCH v14 4/8] io-uring: move io_wait_queue definition to header file Stefan Roesch
2023-06-05 21:20 ` [PATCH v14 5/8] io-uring: add napi busy poll support Stefan Roesch
2023-06-05 21:20 ` [PATCH v14 6/8] io-uring: add sqpoll support for napi busy poll Stefan Roesch
2023-06-05 21:20 ` [PATCH v14 7/8] io_uring: add register/unregister napi function Stefan Roesch
2023-06-05 21:20 ` [PATCH v14 8/8] io_uring: add prefer busy poll to register and unregister napi api Stefan Roesch

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=ZH8GK0SIMEnAzUzc@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olivier@trillion01.com \
    --cc=shr@devkernel.io \
    /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.