diff mbox series

[v2,2/2] io_uring/io-wq: limit io poller cpuset to ambient one

Message ID 20240910154535.140587-3-felix.moessbauer@siemens.com (mailing list archive)
State New
Headers show
Series io_uring/io-wq: respect cgroup cpusets | expand

Commit Message

Felix Moessbauer Sept. 10, 2024, 3:45 p.m. UTC
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>
---
 io_uring/io-wq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe Sept. 10, 2024, 4:06 p.m. UTC | #1
On 9/10/24 9:45 AM, Felix Moessbauer wrote:
> 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.

This still has that same ambient usage in the title which I just
cannot make sense of?
diff mbox series

Patch

diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index c7055a8895d7..a38f36b68060 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -1168,7 +1168,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);