lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150512122545.GN21418@twins.programming.kicks-ass.net>
Date:	Tue, 12 May 2015 14:25:45 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Julian Anastasov <ja@....bg>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>, linux-kernel@...r.kernel.org,
	neilb@...e.de
Subject: Re: [PATCH] sched: Introduce TASK_NOLOAD and TASK_IDLE

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 :-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ