All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: Julia Lawall <Julia.Lawall@inria.fr>,
	vbabka@suse.cz, linus.luessing@c0d3.blue
Cc: Marek Lindner <mareklindner@neomailbox.ch>,
	kernel-janitors@vger.kernel.org, paulmck@kernel.org,
	Simon Wunderlich <sw@simonwunderlich.de>,
	Antonio Quartulli <a@unstable.cc>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
Date: Mon, 14 Oct 2024 09:03:30 +0200	[thread overview]
Message-ID: <6091264.lOV4Wx5bFT@ripper> (raw)
In-Reply-To: <20241013201704.49576-7-Julia.Lawall@inria.fr>

[-- Attachment #1: Type: text/plain, Size: 4045 bytes --]

On Sunday, 13 October 2024 22:16:53 CEST Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
> 
> The changes were made using Coccinelle.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>  net/batman-adv/translation-table.c |   47 ++-----------------------------------
>  1 file changed, 3 insertions(+), 44 deletions(-)


This was tried and we noticed that it is not safe [1]. So, I would get 
confirmation that commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() 
from kmem_cache_destroy()") is fixing the problem which we had at that time. 
The commit message sounds like it but I just want to be sure.

Kind regards,
	Sven

[1] https://lore.kernel.org/r/20240612133357.2596-1-linus.luessing@c0d3.blue

> 
> diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
> index 2243cec18ecc..b21ff3c36b07 100644
> --- a/net/batman-adv/translation-table.c
> +++ b/net/batman-adv/translation-table.c
> @@ -208,20 +208,6 @@ batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
>  	return tt_global_entry;
>  }
>  
> -/**
> - * batadv_tt_local_entry_free_rcu() - free the tt_local_entry
> - * @rcu: rcu pointer of the tt_local_entry
> - */
> -static void batadv_tt_local_entry_free_rcu(struct rcu_head *rcu)
> -{
> -	struct batadv_tt_local_entry *tt_local_entry;
> -
> -	tt_local_entry = container_of(rcu, struct batadv_tt_local_entry,
> -				      common.rcu);
> -
> -	kmem_cache_free(batadv_tl_cache, tt_local_entry);
> -}
> -
>  /**
>   * batadv_tt_local_entry_release() - release tt_local_entry from lists and queue
>   *  for free after rcu grace period
> @@ -236,7 +222,7 @@ static void batadv_tt_local_entry_release(struct kref *ref)
>  
>  	batadv_softif_vlan_put(tt_local_entry->vlan);
>  
> -	call_rcu(&tt_local_entry->common.rcu, batadv_tt_local_entry_free_rcu);
> +	kfree_rcu(tt_local_entry, common.rcu);
>  }
>  
>  /**
> @@ -254,20 +240,6 @@ batadv_tt_local_entry_put(struct batadv_tt_local_entry *tt_local_entry)
>  		 batadv_tt_local_entry_release);
>  }
>  
> -/**
> - * batadv_tt_global_entry_free_rcu() - free the tt_global_entry
> - * @rcu: rcu pointer of the tt_global_entry
> - */
> -static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu)
> -{
> -	struct batadv_tt_global_entry *tt_global_entry;
> -
> -	tt_global_entry = container_of(rcu, struct batadv_tt_global_entry,
> -				       common.rcu);
> -
> -	kmem_cache_free(batadv_tg_cache, tt_global_entry);
> -}
> -
>  /**
>   * batadv_tt_global_entry_release() - release tt_global_entry from lists and
>   *  queue for free after rcu grace period
> @@ -282,7 +254,7 @@ void batadv_tt_global_entry_release(struct kref *ref)
>  
>  	batadv_tt_global_del_orig_list(tt_global_entry);
>  
> -	call_rcu(&tt_global_entry->common.rcu, batadv_tt_global_entry_free_rcu);
> +	kfree_rcu(tt_global_entry, common.rcu);
>  }
>  
>  /**
> @@ -407,19 +379,6 @@ static void batadv_tt_global_size_dec(struct batadv_orig_node *orig_node,
>  	batadv_tt_global_size_mod(orig_node, vid, -1);
>  }
>  
> -/**
> - * batadv_tt_orig_list_entry_free_rcu() - free the orig_entry
> - * @rcu: rcu pointer of the orig_entry
> - */
> -static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
> -{
> -	struct batadv_tt_orig_list_entry *orig_entry;
> -
> -	orig_entry = container_of(rcu, struct batadv_tt_orig_list_entry, rcu);
> -
> -	kmem_cache_free(batadv_tt_orig_cache, orig_entry);
> -}
> -
>  /**
>   * batadv_tt_orig_list_entry_release() - release tt orig entry from lists and
>   *  queue for free after rcu grace period
> @@ -433,7 +392,7 @@ static void batadv_tt_orig_list_entry_release(struct kref *ref)
>  				  refcount);
>  
>  	batadv_orig_node_put(orig_entry->orig_node);
> -	call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
> +	kfree_rcu(orig_entry, rcu);
>  }
>  
>  /**
> 
> 


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2024-10-14  7:03 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
2024-10-13 20:16 ` [PATCH 01/17] wireguard: allowedips: " Julia Lawall
2024-10-16 11:04   ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 02/17] ipv4: " Julia Lawall
2024-10-14  7:41   ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 03/17] inetpeer: " Julia Lawall
2024-10-14  7:42   ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 04/17] ipv6: " Julia Lawall
2024-10-14  7:43   ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 05/17] xfrm6_tunnel: " Julia Lawall
2024-10-16 11:05   ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 06/17] batman-adv: " Julia Lawall
2024-10-14  7:03   ` Sven Eckelmann [this message]
2024-10-14  7:08     ` Julia Lawall
2024-10-14  7:19       ` Vlastimil Babka
2024-10-14  8:03   ` Sven Eckelmann
2024-10-13 20:16 ` [PATCH 07/17] eCryptfs: " Julia Lawall
2024-10-16 11:06   ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 08/17] net: bridge: " Julia Lawall
2024-10-14  7:04   ` Nikolay Aleksandrov
2024-10-16 11:07   ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 09/17] block: " Julia Lawall
2024-10-16 11:08   ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 10/17] can: gw: " Julia Lawall
2024-10-14  3:03   ` Vincent MAILHOL
2024-10-13 20:16 ` [PATCH 11/17] posix-timers: " Julia Lawall
2024-10-16 12:13   ` Uladzislau Rezki
2024-10-24  9:29   ` [tip: timers/core] posix-timers: Replace call_rcu() by kfree_rcu() for simple kmem_cache_free() callback tip-bot2 for Julia Lawall
2024-10-13 20:16 ` [PATCH 12/17] nfsd: replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
2024-10-13 23:16   ` cel
2024-10-13 20:17 ` [PATCH 13/17] KVM: PPC: " Julia Lawall
2024-10-16 12:14   ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 14/17] kcm: " Julia Lawall
2024-10-16 12:16   ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 15/17] netfilter: nf_conncount: " Julia Lawall
2024-10-16 12:18   ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 16/17] netfilter: expect: " Julia Lawall
2024-10-16 12:18   ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 17/17] netfilter: xt_hashlimit: " Julia Lawall
2024-10-16 12:19   ` Uladzislau Rezki
2024-10-13 20:53 ` (subset) [PATCH 00/17] " Jens Axboe
2024-10-14  0:31 ` Paul E. McKenney
2024-10-14  7:23 ` Vlastimil Babka
2024-10-14 11:26 ` Pablo Neira Ayuso
2024-10-15 13:40 ` patchwork-bot+netdevbpf
2024-10-15 18:00 ` patchwork-bot+netdevbpf
2024-11-17 11:56 ` (subset) " Michael Ellerman

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=6091264.lOV4Wx5bFT@ripper \
    --to=sven@narfation.org \
    --cc=Julia.Lawall@inria.fr \
    --cc=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linus.luessing@c0d3.blue \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=sw@simonwunderlich.de \
    --cc=vbabka@suse.cz \
    /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.