From: liyueyi <liyueyi@live.com>
To: peterz@infradead.org, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, liyueyi <liyueyi@xiaomi.com>
Subject: [PATCH] kthread: set kthread state to TASK_IDLE.
Date: Wed, 1 Apr 2020 14:52:15 +0800 [thread overview]
Message-ID: <DM6PR11MB3531D3B164357B2DC476102DDFC90@DM6PR11MB3531.namprd11.prod.outlook.com> (raw)
From: liyueyi <liyueyi@xiaomi.com>
Currently kthread() sleeps in TASK_UNINTERRUPTIBLE state waiting
for the first wakeup, it may be detected by DETECT_HUNG_TASK if
the first wakeup is coming later. Since kernel has introduced
TASK_IDLE, change kthread state to TASK_IDLE.
Signed-off-by: liyueyi <liyueyi@xiaomi.com>
---
kernel/kthread.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/kthread.c b/kernel/kthread.c
index b262f470..f841419 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -243,7 +243,7 @@ static int kthread(void *_create)
current->vfork_done = &self->exited;
/* OK, tell user we're spawned, wait for stop or wakeup */
- __set_current_state(TASK_UNINTERRUPTIBLE);
+ __set_current_state(TASK_IDLE);
create->result = current;
complete(done);
schedule();
@@ -415,7 +415,7 @@ static void __kthread_bind(struct task_struct *p, unsigned int cpu, long state)
void kthread_bind_mask(struct task_struct *p, const struct cpumask *mask)
{
- __kthread_bind_mask(p, mask, TASK_UNINTERRUPTIBLE);
+ __kthread_bind_mask(p, mask, TASK_IDLE);
}
/**
@@ -429,7 +429,7 @@ void kthread_bind_mask(struct task_struct *p, const struct cpumask *mask)
*/
void kthread_bind(struct task_struct *p, unsigned int cpu)
{
- __kthread_bind(p, cpu, TASK_UNINTERRUPTIBLE);
+ __kthread_bind(p, cpu, TASK_IDLE);
}
EXPORT_SYMBOL(kthread_bind);
--
2.7.4
next reply other threads:[~2020-04-01 6:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 6:52 liyueyi [this message]
2020-04-01 9:39 ` [PATCH] kthread: set kthread state to TASK_IDLE Peter Zijlstra
[not found] ` <DM6PR11MB3531904888FBD86F4ED43009DFC90@DM6PR11MB3531.namprd11.prod.outlook.com>
2020-04-01 11:12 ` Peter Zijlstra
2020-04-01 12:27 ` Yueyi Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR11MB3531D3B164357B2DC476102DDFC90@DM6PR11MB3531.namprd11.prod.outlook.com \
--to=liyueyi@live.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liyueyi@xiaomi.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).