Repository navigation
[eve-kernel-arm64-v6.1.155-generic] io_uring/io-wq: apply the current cpuset to new workers - #342
Merged
rene merged 1 commit intoNov 23, 2026
Conversation
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: 6.1 keeps an io_wqe per NUMA node, each with its own cpu_mask, so the node's CPUs take the place of all CPUs: io_wq_create() and the reset in io_wq_cpu_affinity() set cpumask_of_node() again, as before the backport of 84eacf1, and each worker gets the node's CPUs that its cpuset allows.] Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
rene
approved these changes
Nov 19, 2026
rene
approved these changes
Nov 23, 2026
rene
merged commit Nov 23, 2026
1216a9e
into
lf-edge:eve-kernel-arm64-v6.1.155-generic
2 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #336 to
eve-kernel-arm64-v6.1.155-generic: upstream0659e44ce739"io_uring/io-wq: apply the current cpuset to new workers" (applied by Jens Axboe toio_uring-7.4,Cc: stable; not in a mainline release yet).6.1 has the bug: stable backported
84eacf177faa("io_uring/io-wq: inherit cpuset of cgroup in io worker") to 6.1.113 as657ca82526d0, 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. (#336 listed this branch as not affected; that was wrong.)Key adaptations for 6.1
struct io_wqeper NUMA node, each with its owncpu_mask; mainline merged them intostruct io_wqin v6.4 (dfd63baf892c,eb47943f2238). The node's CPUs take the place of "all CPUs":io_wq_create()and unregisteringIORING_REGISTER_IOWQ_AFFsetcpumask_of_node()again, as 6.1 did before657ca82526d0, and each new worker gets the node's CPUs that its current cpuset allows, or the cpuset if they have none in common.struct io_wqeinstead ofstruct io_wq.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:IORING_REGISTER_IOWQ_AFF/ unregisterTwo NUMA nodes (CPUs 0-3 and 4-7, a socket each), to exercise the per-node masks: without the fix 11 workers ran outside their cgroup's cpuset, with it none. There
growandhotplugreport a node queue's own CPUs within the cpuset (cpuset 2-5 gives node 0's workers 2-3), which is 6.1's per-node design and not a change. No lockdep or sleep-in-atomic reports.arm64:
io_uring/cross-compiled witheve_defconfig(NUMA, cpusets on) atW=1: no warnings inio-wq.c. Not run on arm64 hardware.🤖 Generated with Claude Code