Skip to content

Commit 0a7de4a

Browse files
Eric Dumazetkuba-moo
Eric Dumazet
authored andcommitted
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: Eric Dumazet <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 22d046a commit 0a7de4a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

include/net/rps.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ struct rps_dev_flow_table {
5757
* meaning we use 32-6=26 bits for the hash.
5858
*/
5959
struct rps_sock_flow_table {
60-
u32 mask;
60+
struct rcu_head rcu;
61+
u32 mask;
6162

62-
u32 ents[] ____cacheline_aligned_in_smp;
63+
u32 ents[] ____cacheline_aligned_in_smp;
6364
};
6465
#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num]))
6566

net/core/dev.h

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct cpumask;
1515
/* Random bits of netdevice that don't need to be exposed */
1616
#define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */
1717
struct sd_flow_limit {
18+
struct rcu_head rcu;
1819
unsigned int count;
1920
u8 log_buckets;
2021
unsigned int history_head;

net/core/sysctl_net_core.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static int rps_sock_flow_sysctl(const struct ctl_table *table, int write,
201201
if (orig_sock_table) {
202202
static_branch_dec(&rps_needed);
203203
static_branch_dec(&rfs_needed);
204-
kvfree_rcu_mightsleep(orig_sock_table);
204+
kvfree_rcu(orig_sock_table, rcu);
205205
}
206206
}
207207
}
@@ -239,7 +239,7 @@ static int flow_limit_cpu_sysctl(const struct ctl_table *table, int write,
239239
lockdep_is_held(&flow_limit_update_mutex));
240240
if (cur && !cpumask_test_cpu(i, mask)) {
241241
RCU_INIT_POINTER(sd->flow_limit, NULL);
242-
kfree_rcu_mightsleep(cur);
242+
kfree_rcu(cur, rcu);
243243
} else if (!cur && cpumask_test_cpu(i, mask)) {
244244
cur = kzalloc_node(len, GFP_KERNEL,
245245
cpu_to_node(i));

0 commit comments

Comments
 (0)