lkml.org 
[lkml]   [2014]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [trace events] WARNING: CPU: 0 PID: 91 at kernel/sched/core.c:7253 __might_sleep()
On Wed, Oct 08, 2014 at 11:08:25AM -0400, Steven Rostedt wrote:
> > Steve, wth is that thing supposed to do?
> >
> > set_current_state(TASK_INTERRUPTIBLE);
> > while (!kthread_should_stop())
> > schedule();
> >
> > That looks broken alright. It'll revert to a yield() 'spin' loop if it
> > ever gets a wakeup for anything other than the kthread_stop().
> >
> > Did you mean to write something like:
> >
> > set_current_state(TASK_INTERRUPTIBLE);
> > while (!kthread_should_stop()) {
> > schedule();
> > set_current_state(TASK_INTERRUPTIBLE);
> > }
> > __set_current_state(TASK_RUNNING);
> >
> > ?
>
> Wow, what a blast from the past. That code hasn't been touched since
> 2009!
>
> Anyway, all that thread did was call test work on each cpu, and then
> waits to be killed. It should only get a single wake up and that should
> be from the kthread_stop() call. IOW, that loop should never be
> executed more than once.
>
> What exactly is the bug here?

The bug is as explained, the loop is wrong and will revert to a yield
'spin' loop after a single wakeup.

The debugging that caught it is that you exit the loop without setting
TASK_RUNNING.


\
 
 \ /
  Last update: 2014-10-08 18:21    [W:0.834 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site