]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring/io-wq: inherit cpuset of cgroup in io worker
authorFelix Moessbauer <felix.moessbauer@siemens.com>
Tue, 10 Sep 2024 17:11:57 +0000 (19:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:32:33 +0000 (16:32 +0200)
[ Upstream commit 84eacf177faa605853c58e5b1c0d9544b88c16fd ]

The io worker threads are userland threads that just never exit to the
userland. By that, they are also assigned to a cgroup (the group of the
creating task).

When creating a new io worker, this worker should inherit the cpuset
of the cgroup.

Fixes: da64d6db3bd3 ("io_uring: One wqe per wq")
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Link: https://lore.kernel.org/r/20240910171157.166423-3-felix.moessbauer@siemens.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/io-wq.c

index e38bbd07563ee9135178120b68905c07e81ddb4a..b59a1bf844cf9d7bf65976ddf7faf787ec7957d1 100644 (file)
@@ -1167,7 +1167,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
 
        if (!alloc_cpumask_var(&wq->cpu_mask, GFP_KERNEL))
                goto err;
-       cpumask_copy(wq->cpu_mask, cpu_possible_mask);
+       cpuset_cpus_allowed(data->task, wq->cpu_mask);
        wq->acct[IO_WQ_ACCT_BOUND].max_workers = bounded;
        wq->acct[IO_WQ_ACCT_UNBOUND].max_workers =
                                task_rlimit(current, RLIMIT_NPROC);