Signed-off-by: Stefan Metzmacher <metze@xxxxxxxxx> --- fs/io_uring.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 059bf8b9eb72..e7e2d87cd9c1 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6690,18 +6690,8 @@ static int io_sq_thread(void *data) struct io_sq_data *sqd = data; struct io_ring_ctx *ctx; unsigned long timeout = 0; - char buf[TASK_COMM_LEN]; DEFINE_WAIT(wait); - sprintf(buf, "iou-sqp-%d", sqd->task_pid); - set_task_comm(current, buf); - - if (sqd->sq_cpu != -1) - set_cpus_allowed_ptr(current, cpumask_of(sqd->sq_cpu)); - else - set_cpus_allowed_ptr(current, cpu_online_mask); - current->flags |= PF_NO_SETAFFINITY; - down_read(&sqd->rw_lock); while (!test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) { @@ -7853,6 +7843,7 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, fdput(f); } if (ctx->flags & IORING_SETUP_SQPOLL) { + char tsk_comm[TASK_COMM_LEN]; struct task_struct *tsk; struct io_sq_data *sqd; bool attached; @@ -7914,6 +7905,15 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, goto err_sqpoll; } + sprintf(tsk_comm, "iou-sqp-%d", sqd->task_pid); + set_task_comm(tsk, tsk_comm); + + if (sqd->sq_cpu != -1) + set_cpus_allowed_ptr(tsk, cpumask_of(sqd->sq_cpu)); + else + set_cpus_allowed_ptr(tsk, cpu_online_mask); + tsk->flags |= PF_NO_SETAFFINITY; + sqd->thread = tsk; ret = io_uring_alloc_task_context(tsk, ctx); wake_up_new_task(tsk); -- 2.25.1