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

net-sysfs: remove rcu field from 'struct rps_dev_flow_table'



Remove rps_dev_flow_table_release() in favor of kvfree_rcu_mightsleep().

In the following pach, we will remove "u8 @log" field
and 'struct rps_dev_flow_table' size will be a power-of-two.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260302181432.1836150-7-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 68b6394a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ struct rps_dev_flow {
 */
struct rps_dev_flow_table {
	u8			log;
	struct rcu_head		rcu;
	struct rps_dev_flow	flows[];
};
#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
+2 −9
Original line number Diff line number Diff line
@@ -1072,13 +1072,6 @@ static ssize_t show_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
	return sysfs_emit(buf, "%lu\n", val);
}

static void rps_dev_flow_table_release(struct rcu_head *rcu)
{
	struct rps_dev_flow_table *table = container_of(rcu,
	    struct rps_dev_flow_table, rcu);
	vfree(table);
}

static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
					    const char *buf, size_t len)
{
@@ -1131,7 +1124,7 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
				       RCU_INITIALIZER(table)));

	if (old_table)
		call_rcu(&old_table->rcu, rps_dev_flow_table_release);
		kvfree_rcu_mightsleep(old_table);

	return len;
}
@@ -1168,7 +1161,7 @@ static void rx_queue_release(struct kobject *kobj)

	old_table = unrcu_pointer(xchg(&queue->rps_flow_table, NULL));
	if (old_table)
		call_rcu(&old_table->rcu, rps_dev_flow_table_release);
		kvfree_rcu_mightsleep(old_table);
#endif

	memset(kobj, 0, sizeof(*kobj));