diff mbox series

[v2,05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()

Message ID 20230315181902.4177819-5-joel@joelfernandes.org (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series None | expand

Commit Message

Joel Fernandes March 15, 2023, 6:18 p.m. UTC
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
of the single-argument forms, which can introduce functionality bugs in
atomic contexts and latency bugs in non-atomic contexts.

Cc: Eric Dumazet <edumazet@google.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 net/core/sysctl_net_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Joel Fernandes March 26, 2023, 12:28 p.m. UTC | #1
On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
<joel@joelfernandes.org> wrote:
>
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>
> The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
> deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
> kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
> of the single-argument forms, which can introduce functionality bugs in
> atomic contexts and latency bugs in non-atomic contexts.
>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: David S. Miller <davem@davemloft.net>

Could anyone from the networking side Ack this patch so we can take it for 6.4?

Eric or David?

 - Joel

> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  net/core/sysctl_net_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
> index 74842b453407..782273bb93c2 100644
> --- a/net/core/sysctl_net_core.c
> +++ b/net/core/sysctl_net_core.c
> @@ -177,7 +177,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
>                         if (orig_sock_table) {
>                                 static_branch_dec(&rps_needed);
>                                 static_branch_dec(&rfs_needed);
> -                               kvfree_rcu(orig_sock_table);
> +                               kvfree_rcu_mightsleep(orig_sock_table);
>                         }
>                 }
>         }
> @@ -215,7 +215,7 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
>                                      lockdep_is_held(&flow_limit_update_mutex));
>                         if (cur && !cpumask_test_cpu(i, mask)) {
>                                 RCU_INIT_POINTER(sd->flow_limit, NULL);
> -                               kfree_rcu(cur);
> +                               kfree_rcu_mightsleep(cur);
>                         } else if (!cur && cpumask_test_cpu(i, mask)) {
>                                 cur = kzalloc_node(len, GFP_KERNEL,
>                                                    cpu_to_node(i));
> --
> 2.40.0.rc1.284.g88254d51c5-goog
>
Jakub Kicinski March 27, 2023, 5:14 p.m. UTC | #2
On Sun, 26 Mar 2023 08:28:45 -0400 Joel Fernandes wrote:
> > Cc: Eric Dumazet <edumazet@google.com>
> > Cc: David S. Miller <davem@davemloft.net>  
> 
> Could anyone from the networking side Ack this patch so we can take it for 6.4?
> 
> Eric or David?

Let me help you. Perhaps it's a data point against keeping maintainers 
in an alphabetical order :-)

Acked-by: Jakub Kicinski <kuba@kernel.org>
diff mbox series

Patch

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 74842b453407..782273bb93c2 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -177,7 +177,7 @@  static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
 			if (orig_sock_table) {
 				static_branch_dec(&rps_needed);
 				static_branch_dec(&rfs_needed);
-				kvfree_rcu(orig_sock_table);
+				kvfree_rcu_mightsleep(orig_sock_table);
 			}
 		}
 	}
@@ -215,7 +215,7 @@  static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
 				     lockdep_is_held(&flow_limit_update_mutex));
 			if (cur && !cpumask_test_cpu(i, mask)) {
 				RCU_INIT_POINTER(sd->flow_limit, NULL);
-				kfree_rcu(cur);
+				kfree_rcu_mightsleep(cur);
 			} else if (!cur && cpumask_test_cpu(i, mask)) {
 				cur = kzalloc_node(len, GFP_KERNEL,
 						   cpu_to_node(i));