From: Peter Zijlstra <peterz@infradead.org>
To: Julian Anastasov <ja@ssi.bg>
Cc: Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org, neilb@suse.de
Subject: Re: [PATCH] sched: Introduce TASK_NOLOAD and TASK_IDLE
Date: Tue, 12 May 2015 14:25:45 +0200 [thread overview]
Message-ID: <20150512122545.GN21418@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <alpine.LFD.2.11.1505112154420.1749@ja.home.ssi.bg>
On Mon, May 11, 2015 at 10:34:11PM +0300, Julian Anastasov wrote:
> 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.
Fair enough I suppose, but then calling it schedule*() is just plain
wrong, it does not behave/act like a normal schedule() call.
Lemme go look at how widely abused that is.
*sigh*, its all over the place :/
$ git grep "schedule_timeout_\(interruptible\|killable\|uninterruptible\)" | wc -l
392
That said; I still don't see the point of schedule_timeout_idle(), we
should not sleep poll for state like that. We should only use TASK_IDLE
when we are in fact _IDLE_ and do not have work to do, at which point
one should use an wait_event() like construct to wait for new work.
> > + * 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...
I'm fairly sure that might aid in compilation indeed :-)
next prev parent reply other threads:[~2015-05-12 12:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 12:47 Peter Zijlstra
2015-05-09 8:49 ` Julian Anastasov
2015-05-11 7:11 ` NeilBrown
2015-05-11 14:22 ` Peter Zijlstra
2015-05-11 19:34 ` Julian Anastasov
2015-05-12 12:25 ` Peter Zijlstra [this message]
2015-05-13 7:22 ` Julian Anastasov
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=20150512122545.GN21418@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ja@ssi.bg \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=neilb@suse.de \
--cc=oleg@redhat.com \
--cc=torvalds@linux-foundation.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
Powered by JetHome