Commit 0a7de4a8 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski
Browse files

net: rps: remove kfree_rcu_mightsleep() use



Add an rcu_head to sd_flow_limit and rps_sock_flow_table structs
to use the more conventional and predictable k[v]free_rcu().

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250407163602.170356-5-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 22d046a7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ struct rps_dev_flow_table {
 * meaning we use 32-6=26 bits for the hash.
 */
struct rps_sock_flow_table {
	struct rcu_head	rcu;
	u32		mask;

	u32		ents[] ____cacheline_aligned_in_smp;
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ struct cpumask;
/* Random bits of netdevice that don't need to be exposed */
#define FLOW_LIMIT_HISTORY	(1 << 7)  /* must be ^2 and !overflow buckets */
struct sd_flow_limit {
	struct rcu_head		rcu;
	unsigned int		count;
	u8			log_buckets;
	unsigned int		history_head;
+2 −2
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ static int rps_sock_flow_sysctl(const struct ctl_table *table, int write,
			if (orig_sock_table) {
				static_branch_dec(&rps_needed);
				static_branch_dec(&rfs_needed);
				kvfree_rcu_mightsleep(orig_sock_table);
				kvfree_rcu(orig_sock_table, rcu);
			}
		}
	}
@@ -239,7 +239,7 @@ static int flow_limit_cpu_sysctl(const 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_mightsleep(cur);
				kfree_rcu(cur, rcu);
			} else if (!cur && cpumask_test_cpu(i, mask)) {
				cur = kzalloc_node(len, GFP_KERNEL,
						   cpu_to_node(i));