Skip to content

[eve-kernel-arm64-v7.0.14-nvidia-gb] io_uring/io-wq: apply the current cpuset to new workers - #344

Merged
rene merged 1 commit into
lf-edge:eve-kernel-arm64-v7.0.14-nvidia-gbfrom
rucoder:backport/iowq-cpuset-arm64-v7.0.14-nvidia-gb
Nov 23, 2026
Merged

rene merged 1 commit into
lf-edge:eve-kernel-arm64-v7.0.14-nvidia-gbfrom
rucoder:backport/iowq-cpuset-arm64-v7.0.14-nvidia-gb

Conversation

@rucoder

@rucoder rucoder commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Backport of #336 to eve-kernel-arm64-v7.0.14-nvidia-gb: upstream 0659e44ce739 "io_uring/io-wq: apply the current cpuset to new workers" (applied by Jens Axboe to io_uring-7.4, Cc: stable; not in a mainline release yet).

7.0.14 has the bug: io_wq_create() copies the creating task's cpuset into wq->cpu_mask (84eacf177faa, "io_uring/io-wq: inherit cpuset of cgroup in io worker"), so io-wq workers started after a cpuset change, or after the task moves to another cgroup, run on the CPUs the cgroup had when the io-wq was created.

Key adaptations for eve-kernel-arm64-v7.0.14-nvidia-gb

  • The code is the upstream change line for line. The only conflict was its context: io_worker_retire(), which precedes the new helpers upstream (a later io-wq fix), is not in this branch.

Validation

This branch's source built for x86_64 under QEMU/KVM (8 CPUs, cgroup v2, lockdep, CPUMASK_OFFSTACK; the io-wq code has no architecture-specific parts), the same test as #336:

case without the fix with the fix
cpuset 2-3 -> 4-5, new workers FAIL PASS
idle worker retired after the change FAIL PASS
cpuset grows 2-3 -> 2-5 FAIL PASS
cgroup move 2-3 -> 4-5 FAIL PASS
IORING_REGISTER_IOWQ_AFF / unregister FAIL PASS
CPU hotplug PASS PASS

No lockdep or sleep-in-atomic reports. arm64: io_uring/ cross-compiled with eve_defconfig (NUMA, cpusets on) at W=1: no warnings in io-wq.c. Not run on arm64 hardware.

🤖 Generated with Claude Code

commit 0659e44ce739ecd856164c75a5325b7959a2921d upstream.

Since commit 84eacf1 ("io_uring/io-wq: inherit cpuset of cgroup in
io worker"), io_wq_create() copies the cpuset of the creating task into
wq->cpu_mask, and io_init_new_worker() gives each new worker that copy.
A cpuset change, or a move of the task to another cgroup, updates the
workers that exist but not the copy, so workers started later run on
the CPUs the cgroup had when the io-wq was created, which may since
have been given to other tasks. Workers come and go for the life of the
io-wq, and a worker that cpuset moved is also retired at its next idle
timeout and replaced on the old CPUs.

Keep wq->cpu_mask for the affinity of the io-wq itself, all CPUs or the
mask set with IORING_REGISTER_IOWQ_AFF, and intersect it with the cpuset
of the worker when the worker starts, falling back to the cpuset if the
two do not intersect, as __set_cpus_allowed_ptr() does. Use the same
mask in the idle exit test, and go back to all CPUs when the registered
affinity is removed.

Fixes: 84eacf1 ("io_uring/io-wq: inherit cpuset of cgroup in io worker")
Cc: stable@vger.kernel.org
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
Link: https://patch.msgid.link/20261111162705.1150983-1-mike.malyshev@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[Backport: the code is the upstream change; the conflict was only in
 its context: io_worker_retire(), which precedes the new helpers
 upstream, is not in this tree.]
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
@rene
rene merged commit 0b830ac into lf-edge:eve-kernel-arm64-v7.0.14-nvidia-gb Nov 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants