diff mbox series

[v2,6/6] trace/hwlat: Make use of the helper macro kthread_run_on_cpu()

Message ID 20211021122758.3092-7-caihuoqing@baidu.com (mailing list archive)
State Not Applicable
Headers show
Series kthread: Add the helper macro kthread_run_on_cpu() | expand

Commit Message

Cai,Huoqing Oct. 21, 2021, 12:27 p.m. UTC
Repalce kthread_create_on_cpu/wake_up_process()
with kthread_run_on_cpu() to simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Update changelog.

 kernel/trace/trace_hwlat.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Bart Van Assche Oct. 21, 2021, 4:31 p.m. UTC | #1
On 10/21/21 5:27 AM, Cai Huoqing wrote:
> Repalce kthread_create_on_cpu/wake_up_process()

Repalce -> Replace ?

Thanks,

Bart.
diff mbox series

Patch

diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index 1b83d75eb103..0e555335f095 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;
 }