Skip to contentSkip to conversation

dql: Reset the adjusted limit when resetting the queue

PATCH Applied Hungyu Lin 2 participants 2 messages Nov 9 – Nov 12

Subsystems (3)
lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

PATCH v2 1/1 dql: Reset the adjusted limit when resetting the queue

dql_reset() restores limit to min_limit and clears the cumulative queue and completion counts, but retains adj_limit from the previous queue lifetime. dql_avail() therefore uses stale credit until the next nonzero TX completion.

Reset adj_limit to limit as well so that adj_limit = limit + num_completed also holds immediately after a reset.

Found by code inspection and reproduced with QEMU virtio-net TX ring resizes, using identical reset/completion tracing in both test kernels.

Fixes 75957ba36c05 ("dql: Dynamic queue limits")

---
Changes in v2:
- Target net-next and drop the stable Cc, as requested by Eric Dumazet.
- Add validation results; code unchanged from v1.

v1: https://lore.kernel.org/netdev/[email protected]/

Testing on Linux 7.4-rc1 (6628e7d4c6b):
QEMU virtio-net, TX ring resize 256 -> 128, and real UDP/TCP traffic. With a low-priority UDP burst followed by a high-priority probe and QEMU tx=timer,x-txtimer=5000000,x-txburst=1, median probe RTT was 349.15 ms before and 12.09 ms after the change (12 trials per version). No consistent TCP throughput gain was observed, including 64 MiB transfers with normal TX service.

Rebased onto net-next fa5196392691; the ARM64 W=1 DQL object build and strict checkpatch passed.

 lib/dynamic_queue_limits.c | 1 +
 1 file changed, 1 insertion(+)
lib/dynamic_queue_limits.c +1 -0
index f97a752e900a..acef6a35ba3d 100644
@@ -191,6 +191,7 @@ void dql_reset(struct dql *dql)
 {
 	/* Reset all dynamic values */
 	dql->limit = dql->min_limit;
+	dql->adj_limit = dql->limit;
 	dql->num_queued = 0;
 	dql->num_completed = 0;
 	dql->last_obj_cnt = 0;
Signature · 1 line
2.43.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Mon, 9 Nov 2026 23:00:22 +0000 you wrote:

dql_reset() restores limit to min_limit and clears the cumulative queue and completion counts, but retains adj_limit from the previous queue lifetime. dql_avail() therefore uses stale credit until the next nonzero TX completion.

Reset adj_limit to limit as well so that adj_limit = limit + num_completed also holds immediately after a reset.

[...]

Here is the summary with links:
- [net-next,v2] dql: Reset the adjusted limit when resetting the queue

    https://git.kernel.org/netdev/net-next/c/c46ddd7d7acd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html