From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D584BC433E9 for ; Mon, 15 Mar 2021 17:03:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B104B64DF4 for ; Mon, 15 Mar 2021 17:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbhCORDI (ORCPT ); Mon, 15 Mar 2021 13:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235582AbhCORCW (ORCPT ); Mon, 15 Mar 2021 13:02:22 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE686C06174A for ; Mon, 15 Mar 2021 10:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=o0yc+m9kh41c58kCVURfi74/HsMF9KNOkK53AWnls3Y=; b=trkllKG0MLciizdPnVaxtuv6B2 3sYzKYWHDISHUURDslZ6ec7Wz41vmw3EUQagvAUMbT8Jofb6WIpqmhe+kOSUHXfvedmoIYIKGcs2Y w/zzl9sx0GLvg2NOcR0UHMtRw4rX6Qft0YgVKT9YJ6DnZxIbts1xVK33XKiXvQIOL+D4OQlHeFZ8w V7MYED4JrfTMgkiEWeFrcU3YQoyWFP192yu8KFd9dIBqlINruua3nOXQBxYKz+HpLXIiAjvzm7ETq 7s9F+gXPr4uot49Sd+TztKEZwbqlNrdR8JA/iG0XnD5/4Hsgk6fpuTIK99gTMcHamMObmIebg4U6K W/ZnDZ0h5Gp/1yElQamSlYMZKodybybZLn/U4E/dYxzKKkaiWMNBdatGvpJiKJG9wrztF3vaPhXOg gecJwRNXvzBgmNC0XnGNycWhnt4zaK5mrjzPsLr3Xqftf7G53XAk3YSKSYxeSXY+G5TBEo5ZrGlJo mXTmsRTqpjnUmTFukq1DRmS2; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.3:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim) id 1lLqbj-00056u-UT; Mon, 15 Mar 2021 17:02:20 +0000 From: Stefan Metzmacher To: io-uring@vger.kernel.org Cc: Stefan Metzmacher Subject: [RFC PATCH 03/10] io-wq: call set_task_comm() before wake_up_new_task() Date: Mon, 15 Mar 2021 18:01:41 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Stefan Metzmacher --- 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