From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E1658BE0 for ; Tue, 28 Mar 2023 15:05:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AF8BC433D2; Tue, 28 Mar 2023 15:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680015950; bh=TDK7C4tBc1XL02w3YdJ1crK36dwWk55XRLALtQ6RWm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUdElOrIchfJ3wMre3O9CNbjKbGNTltks25tJ64rY/B3HScebnRA9UP2rqQK27ORd xd8HfY/MqzOsfek9LdWnFKK/ZPGq251VsdvbK0/BCdQJDGXwJl9aeWGi5W/MgOELnX T2YcQ7sCva573HBnUKkcvO1qFljT00TMJVEZIEUk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Cai Huoqing , Bernard Metzler , Daniel Bristot de Oliveira , Davidlohr Bueso , Doug Ledford , Ingo Molnar , Jason Gunthorpe , "Joel Fernandes (Google)" , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E . McKenney" , Steven Rostedt , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.15 011/146] trace/hwlat: make use of the helper function kthread_run_on_cpu() Date: Tue, 28 Mar 2023 16:41:40 +0200 Message-Id: <20230328142603.170881386@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230328142602.660084725@linuxfoundation.org> References: <20230328142602.660084725@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Cai Huoqing [ Upstream commit ff78f6679d2e223e073fcbdc8f70b6bc0abadf99 ] Replace kthread_create_on_cpu/wake_up_process() with kthread_run_on_cpu() to simplify the code. Link: https://lkml.kernel.org/r/20211022025711.3673-7-caihuoqing@baidu.com Signed-off-by: Cai Huoqing Cc: Bernard Metzler Cc: Daniel Bristot de Oliveira Cc: Davidlohr Bueso Cc: Doug Ledford Cc: Ingo Molnar Cc: Jason Gunthorpe Cc: Joel Fernandes (Google) Cc: Josh Triplett Cc: Lai Jiangshan Cc: Mathieu Desnoyers Cc: "Paul E . McKenney" Cc: Steven Rostedt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Stable-dep-of: 08697bca9bbb ("trace/hwlat: Do not start per-cpu thread if it is already running") Signed-off-by: Sasha Levin --- kernel/trace/trace_hwlat.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c index 455f5edf008b8..72eeab938f1de 100644 --- a/kernel/trace/trace_hwlat.c +++ b/kernel/trace/trace_hwlat.c @@ -491,18 +491,14 @@ static void stop_per_cpu_kthreads(void) static int start_cpu_kthread(unsigned int cpu) { struct task_struct *kthread; - char comm[24]; - snprintf(comm, 24, "hwlatd/%d", cpu); - - kthread = kthread_create_on_cpu(kthread_fn, NULL, cpu, comm); + kthread = kthread_run_on_cpu(kthread_fn, NULL, cpu, "hwlatd/%u"); if (IS_ERR(kthread)) { pr_err(BANNER "could not start sampling thread\n"); return -ENOMEM; } per_cpu(hwlat_per_cpu_data, cpu).kthread = kthread; - wake_up_process(kthread); return 0; } -- 2.39.2