lkml.org 
[lkml]   [2015]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched: Introduce TASK_NOLOAD and TASK_IDLE

Hello,

On Mon, 11 May 2015, Peter Zijlstra wrote:

> > - schedule_timeout_idle (instead of schedule_timeout call):
> > __set_current_state(TASK_IDLE);
> > return schedule_timeout(timeout);
> >
> > - we here are really idle, so "N" looks ok
>
> So I don't get the point of the schedule_timeout_*() stubs. What are
> they for? Why would one use an unconditional schedule_timeout() call?
> Isn't that what msleep() is for?

msleep will not return until timeout has expired.
Instead, we want to notice the kthread_should_stop() event
immediately. Additionally, TASK_UNINTERRUPTIBLE will increase
the load average. We can do it with extra wait queue
and the new __wait_event_idle_timeout but I guess
schedule_timeout_idle will be a good replacement for
schedule_timeout_interruptible calls when used for kthreads.

> + * like wait_event_timeout() -- except it uses TASK_IDLE to avoid loadavg
> + */
> +#define wait_event_idle_timeout(wq, condition, timeout) \
> +({ \
> + long __ret = timeout; \
> + might_sleep(); \
> + if (!___wait_cond_timeout(condition)) \
> + ret = __wait_event_idle_timeout(wq, condition, timeout);\

ret may need underscores here...

Regards

--
Julian Anastasov <ja@ssi.bg>


\
 
 \ /
  Last update: 2015-05-11 22:01    [W:0.045 / U:2.508 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site