Signed-off-by: Stefan Metzmacher <metze@xxxxxxxxx> --- fs/io-wq.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/io-wq.c b/fs/io-wq.c index e05f996d088f..d6b15a627f9a 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -479,14 +479,10 @@ static int io_wqe_worker(void *data) struct io_worker *worker = data; struct io_wqe *wqe = worker->wqe; struct io_wq *wq = wqe->wq; - char buf[TASK_COMM_LEN]; worker->flags |= (IO_WORKER_F_UP | IO_WORKER_F_RUNNING); io_wqe_inc_running(worker); - sprintf(buf, "iou-wrk-%d", wq->task_pid); - set_task_comm(current, buf); - while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) { long ret; @@ -567,6 +563,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index) { struct io_wqe_acct *acct = &wqe->acct[index]; struct io_worker *worker; + char tsk_comm[TASK_COMM_LEN]; struct task_struct *tsk; __set_current_state(TASK_RUNNING); @@ -591,6 +588,9 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index) return false; } + sprintf(tsk_comm, "iou-wrk-%d", wq->task_pid); + set_task_comm(tsk, tsk_comm); + tsk->pf_io_worker = worker; worker->task = tsk; set_cpus_allowed_ptr(tsk, cpumask_of_node(wqe->node)); @@ -702,12 +702,8 @@ static void io_wq_cancel_pending(struct io_wq *wq) static int io_wq_manager(void *data) { struct io_wq *wq = data; - char buf[TASK_COMM_LEN]; int node; - sprintf(buf, "iou-mgr-%d", wq->task_pid); - set_task_comm(current, buf); - do { set_current_state(TASK_INTERRUPTIBLE); io_wq_check_workers(wq); @@ -782,6 +778,11 @@ static int io_wq_fork_manager(struct io_wq *wq) atomic_set(&wq->worker_refs, 1); tsk = create_io_thread(io_wq_manager, wq, NUMA_NO_NODE); if (!IS_ERR(tsk)) { + char tsk_comm[TASK_COMM_LEN]; + + sprintf(tsk_comm, "iou-mgr-%d", wq->task_pid); + set_task_comm(tsk, tsk_comm); + wq->manager = get_task_struct(tsk); wake_up_new_task(tsk); return 0; -- 2.25.1