public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	"Uladzislau Rezki (Sony)" <urezki@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>, RCU <rcu@vger.kernel.org>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>,
	Jens Axboe <axboe@kernel.dk>,
	Philipp Reisner <philipp.reisner@linbit.com>,
	Bryan Tan <bryantan@vmware.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Eric Dumazet <edumazet@google.com>,
	Bob Pearson <rpearsonhpe@gmail.com>,
	Ariel Levkovich <lariel@nvidia.com>,
	Theodore Ts'o <tytso@mit.edu>, Jiri Wiesner <jwiesner@suse.de>
Subject: Re: [PATCH 10/13] ipvs: Rename kfree_rcu() to kfree_rcu_mightsleep()
Date: Wed, 1 Feb 2023 17:52:02 +0100	[thread overview]
Message-ID: <Y9qYsi5x7nxtSsx/@pc636> (raw)
In-Reply-To: <7e87836a-c72-eefd-9c74-fc2637accd2@ssi.bg>

On Wed, Feb 01, 2023 at 06:12:04PM +0200, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Wed, 1 Feb 2023, Pablo Neira Ayuso wrote:
> 
> > Hi,
> > 
> > On Wed, Feb 01, 2023 at 04:09:51PM +0100, Uladzislau Rezki (Sony) wrote:
> > > The kfree_rcu()'s single argument name is deprecated therefore
> > > rename it to kfree_rcu_mightsleep() variant. The goal is explicitly
> > > underline that it is for sleepable contexts.
> > > 
> > > Cc: Julian Anastasov <ja@ssi.bg>
> > > Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> > > Cc: Jiri Wiesner <jwiesner@suse.de>
> > > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> > > ---
> > >  net/netfilter/ipvs/ip_vs_est.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c
> > > index ce2a1549b304..a39baf6d1367 100644
> > > --- a/net/netfilter/ipvs/ip_vs_est.c
> > > +++ b/net/netfilter/ipvs/ip_vs_est.c
> > > @@ -549,7 +549,7 @@ void ip_vs_stop_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats)
> > >  	__set_bit(row, kd->avail);
> > >  	if (!kd->tick_len[row]) {
> > >  		RCU_INIT_POINTER(kd->ticks[row], NULL);
> > > -		kfree_rcu(td);
> > 
> > I also found this kfree_rcu() without rcu_head call a few weeks ago.
> > 
> > @Wiesner, @Julian: Any chance this can be turned into kfree_rcu(td, rcu_head); ?
> 
> 	Yes, as simple as this:
> 
> diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
> index c6c61100d244..6d71a5ff52df 100644
> --- a/include/net/ip_vs.h
> +++ b/include/net/ip_vs.h
> @@ -461,6 +461,7 @@ void ip_vs_stats_free(struct ip_vs_stats *stats);
>  
>  /* Multiple chains processed in same tick */
>  struct ip_vs_est_tick_data {
> +	struct rcu_head		rcu_head;
>  	struct hlist_head	chains[IPVS_EST_TICK_CHAINS];
>  	DECLARE_BITMAP(present, IPVS_EST_TICK_CHAINS);
>  	DECLARE_BITMAP(full, IPVS_EST_TICK_CHAINS);
> diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c
> index df56073bb282..25c7118d9348 100644
> --- a/net/netfilter/ipvs/ip_vs_est.c
> +++ b/net/netfilter/ipvs/ip_vs_est.c
> @@ -549,7 +549,7 @@ void ip_vs_stop_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats)
>  	__set_bit(row, kd->avail);
>  	if (!kd->tick_len[row]) {
>  		RCU_INIT_POINTER(kd->ticks[row], NULL);
> -		kfree_rcu(td);
> +		kfree_rcu(td, rcu_head);
>  	}
>  	kd->est_count--;
>  	if (kd->est_count) {
> 
> 	I was about to reply to Uladzislau Rezki but his patchset
> looks more like a renaming, so I'm not sure how we are about
> to integrate this change, as separate patch or as part of his
> patchset. I don't have preference, just let me know how to
> handle it.
> 
If you give on this patch an Ack i will resend it once i collect
all other ACKs. So it will be integrated via RCU-tree.

So this is just renaming.

If the ip_vs_stop_estimator() can be invoked from an atomic context
then it is a bug and you need to integrate rcu_head in your structure.

--
Uladzislau Rezki

  reply	other threads:[~2023-02-01 16:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 15:09 [PATCH 10/13] ipvs: Rename kfree_rcu() to kfree_rcu_mightsleep() Uladzislau Rezki (Sony)
2023-02-01 15:09 ` [PATCH 11/13] rcuscale: " Uladzislau Rezki (Sony)
2023-02-01 15:09 ` [PATCH 12/13] doc: Update whatisRCU.rst Uladzislau Rezki (Sony)
2023-02-01 15:09 ` [PATCH 13/13] rcu/kvfree: Eliminate k[v]free_rcu() single argument macro Uladzislau Rezki (Sony)
2023-03-05 10:29   ` Joel Fernandes
2023-03-05 10:49     ` Joel Fernandes
2023-03-05 11:41       ` Uladzislau Rezki
2023-03-05 12:56         ` Joel Fernandes
2023-03-05 18:05           ` Paul E. McKenney
2023-03-06 14:49             ` Joel Fernandes
2023-03-06 15:01               ` Paul E. McKenney
2023-03-06 15:12                 ` Joel Fernandes
2023-03-06 16:42                   ` Uladzislau Rezki
2023-03-06 16:55                     ` Paul E. McKenney
2023-03-06 17:10                       ` Uladzislau Rezki
2023-03-06 19:54                         ` Joel Fernandes
2023-02-01 15:53 ` [PATCH 10/13] ipvs: Rename kfree_rcu() to kfree_rcu_mightsleep() Pablo Neira Ayuso
2023-02-01 16:12   ` Julian Anastasov
2023-02-01 16:52     ` Uladzislau Rezki [this message]
2023-02-01 17:10     ` Pablo Neira Ayuso
2023-02-01 17:19       ` Uladzislau Rezki
2023-03-09  0:11         ` Joel Fernandes
2023-03-09  9:19           ` Pablo Neira Ayuso
2023-03-10  1:08             ` Joel Fernandes

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=Y9qYsi5x7nxtSsx/@pc636 \
    --to=urezki@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bryantan@vmware.com \
    --cc=edumazet@google.com \
    --cc=ja@ssi.bg \
    --cc=jwiesner@suse.de \
    --cc=lariel@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksiy.avramchenko@sony.com \
    --cc=pablo@netfilter.org \
    --cc=paulmck@kernel.org \
    --cc=philipp.reisner@linbit.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rpearsonhpe@gmail.com \
    --cc=tytso@mit.edu \
    /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