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

net: add /proc/sys/net/core/txq_reselection_ms control



Add a new sysctl to control how often a queue reselection
can happen even if a flow has a persistent queue of skbs
in a Qdisc or NIC queue.

A value of zero means the feature is disabled.

Default is 1000 (1 second).

This sysctl is used in the following patch.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarNeal Cardwell <ncardwell@google.com>
Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20251013152234.842065-4-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d365c9bc
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -406,6 +406,23 @@ to SOCK_TXREHASH_DEFAULT (i. e. not overridden by setsockopt).
If set to 1 (default), hash rethink is performed on listening socket.
If set to 0, hash rethink is not performed.

txq_reselection_ms
------------------

Controls how often (in ms) a busy connected flow can select another tx queue.

A resection is desirable when/if user thread has migrated and XPS
would select a different queue. Same can occur without XPS
if the flow hash has changed.

But switching txq can introduce reorders, especially if the
old queue is under high pressure. Modern TCP stacks deal
well with reorders if they happen not too often.

To disable this feature, set the value to 0.

Default : 1000

gro_normal_batch
----------------

+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ struct netns_core {
	struct ctl_table_header	*sysctl_hdr;

	int	sysctl_somaxconn;
	int	sysctl_txq_reselection;
	int	sysctl_optmem_max;
	u8	sysctl_txrehash;
	u8	sysctl_tstamp_allow_data;
+1 −0
Original line number Diff line number Diff line
@@ -395,6 +395,7 @@ static __net_init void preinit_net_sysctl(struct net *net)
	net->core.sysctl_optmem_max = 128 * 1024;
	net->core.sysctl_txrehash = SOCK_TXREHASH_ENABLED;
	net->core.sysctl_tstamp_allow_data = 1;
	net->core.sysctl_txq_reselection = msecs_to_jiffies(1000);
}

/* init code that must occur even if setup_net() is not called. */
+7 −0
Original line number Diff line number Diff line
@@ -667,6 +667,13 @@ static struct ctl_table netns_core_table[] = {
		.extra2		= SYSCTL_ONE,
		.proc_handler	= proc_dou8vec_minmax,
	},
	{
		.procname	= "txq_reselection_ms",
		.data		= &init_net.core.sysctl_txq_reselection,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_ms_jiffies,
	},
	{
		.procname	= "tstamp_allow_data",
		.data		= &init_net.core.sysctl_tstamp_allow_data,