Re: [PATCH 1/1] timer: Warn about schedule_timeout() called for tasks in TASK_RUNNING state

From: Steven Rostedt
Date: Thu Jan 16 2020 - 09:55:11 EST


On Thu, 16 Jan 2020 09:52:20 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> > --- a/kernel/time/timer.c
> > +++ b/kernel/time/timer.c
> > @@ -1887,6 +1887,11 @@ signed long __sched schedule_timeout(signed long timeout)
> > }
> > }
> >
> > +#ifdef CONFIG_SCHED_DEBUG
> > + WARN_ONCE(current->state == TASK_RUNNING,
> > + "schedule_timeout for TASK_RUNNING\n");
> > +#endif
> > +
>
> But this can trigger false warnings. For example, if we are waiting on
> an event with a timeout:


Also, there are helpers here that you can use:

schedule_timeout_interruptible(signed long timeout);
schedule_timeout_uninterruptible(signed long timeout)

-- Steve