* [PATCH] kthread: set kthread state to TASK_IDLE. @ 2020-04-01 6:52 liyueyi 2020-04-01 9:39 ` Peter Zijlstra 0 siblings, 1 reply; 4+ messages in thread From: liyueyi @ 2020-04-01 6:52 UTC (permalink / raw) To: peterz, gregkh; +Cc: linux-kernel, liyueyi 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kthread: set kthread state to TASK_IDLE. 2020-04-01 6:52 [PATCH] kthread: set kthread state to TASK_IDLE liyueyi @ 2020-04-01 9:39 ` Peter Zijlstra [not found] ` <DM6PR11MB3531904888FBD86F4ED43009DFC90@DM6PR11MB3531.namprd11.prod.outlook.com> 0 siblings, 1 reply; 4+ messages in thread From: Peter Zijlstra @ 2020-04-01 9:39 UTC (permalink / raw) To: liyueyi; +Cc: gregkh, linux-kernel, liyueyi On Wed, Apr 01, 2020 at 02:52:15PM +0800, liyueyi wrote: > 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. How the heck can that ever happen anyway? Is this some virt brain-damage? And how is it not a real problem when it takes this long? ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <DM6PR11MB3531904888FBD86F4ED43009DFC90@DM6PR11MB3531.namprd11.prod.outlook.com>]
* Re: [PATCH] kthread: set kthread state to TASK_IDLE. [not found] ` <DM6PR11MB3531904888FBD86F4ED43009DFC90@DM6PR11MB3531.namprd11.prod.outlook.com> @ 2020-04-01 11:12 ` Peter Zijlstra 2020-04-01 12:27 ` Yueyi Li 0 siblings, 1 reply; 4+ messages in thread From: Peter Zijlstra @ 2020-04-01 11:12 UTC (permalink / raw) To: Li Yueyi; +Cc: gregkh, linux-kernel, liyueyi A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? On Wed, Apr 01, 2020 at 10:40:28AM +0000, Li Yueyi wrote: > I create a kthread to do some work will trigger system restart, i don`t wake it up immediately but wakeup it in a HW irq handler. > So this kthread sleeps in TASK_UNINTERRUPTIBLE state until the HW irq coming up. > > Did i do something wrong? > Should i wake it up immediately and then call wait_event_xxxx function to sleep it? This! ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kthread: set kthread state to TASK_IDLE. 2020-04-01 11:12 ` Peter Zijlstra @ 2020-04-01 12:27 ` Yueyi Li 0 siblings, 0 replies; 4+ messages in thread From: Yueyi Li @ 2020-04-01 12:27 UTC (permalink / raw) To: Peter Zijlstra; +Cc: gregkh, linux-kernel, liyueyi On 2020/4/1 19:12, Peter Zijlstra wrote: > > A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? > A: Top-posting. > Q: What is the most annoying thing in e-mail? > > On Wed, Apr 01, 2020 at 10:40:28AM +0000, Li Yueyi wrote: >> I create a kthread to do some work will trigger system restart, i don`t wake it up immediately but wakeup it in a HW irq handler. >> So this kthread sleeps in TASK_UNINTERRUPTIBLE state until the HW irq coming up. >> >> Did i do something wrong? >> Should i wake it up immediately and then call wait_event_xxxx function to sleep it? > > This! > Oh~, Sorry about top-posting and....thanks for your answer! ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-01 12:27 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-04-01 6:52 [PATCH] kthread: set kthread state to TASK_IDLE liyueyi 2020-04-01 9:39 ` Peter Zijlstra [not found] ` <DM6PR11MB3531904888FBD86F4ED43009DFC90@DM6PR11MB3531.namprd11.prod.outlook.com> 2020-04-01 11:12 ` Peter Zijlstra 2020-04-01 12:27 ` Yueyi Li
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.