[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20211021084414.2713-1-caihuoqing@baidu.com>
Date: Thu, 21 Oct 2021 16:44:13 +0800
From: Cai Huoqing <caihuoqing@...du.com>
To: <caihuoqing@...du.com>
CC: Jiri Kosina <jikos@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
<x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] x86: Make use of the helper macro kthread_run()
Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.
Signed-off-by: Cai Huoqing <caihuoqing@...du.com>
---
arch/x86/kernel/apm_32.c | 3 +--
arch/x86/mm/pat/cpa-test.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 241dda687eb9..0bc62af68ac5 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -2347,7 +2347,7 @@ static int __init apm_init(void)
proc_create_single("apm", 0, NULL, proc_apm_show);
- kapmd_task = kthread_create(apm, NULL, "kapmd");
+ kapmd_task = kthread_run(apm, NULL, "kapmd");
if (IS_ERR(kapmd_task)) {
pr_err("disabled - Unable to start kernel thread\n");
err = PTR_ERR(kapmd_task);
@@ -2355,7 +2355,6 @@ static int __init apm_init(void)
remove_proc_entry("apm", NULL);
return err;
}
- wake_up_process(kapmd_task);
if (num_online_cpus() > 1 && !smp) {
printk(KERN_NOTICE
diff --git a/arch/x86/mm/pat/cpa-test.c b/arch/x86/mm/pat/cpa-test.c
index 0612a73638a8..8022a5769a45 100644
--- a/arch/x86/mm/pat/cpa-test.c
+++ b/arch/x86/mm/pat/cpa-test.c
@@ -266,10 +266,8 @@ static int start_pageattr_test(void)
{
struct task_struct *p;
- p = kthread_create(do_pageattr_test, NULL, "pageattr-test");
- if (!IS_ERR(p))
- wake_up_process(p);
- else
+ p = kthread_run(do_pageattr_test, NULL, "pageattr-test");
+ if (IS_ERR(p))
WARN_ON(1);
return 0;
--
2.25.1
Powered by blists - more mailing lists