{rtasd,rtc,scanlog}.c schedule_timeout() usage

Nishanth Aravamudan nacc at us.ibm.com
Tue Dec 21 11:25:13 EST 2004

On Sat, Dec 18, 2004 at 09:41:35AM +0100, Benjamin Herrenschmidt wrote:
> On Fri, 2004-12-17 at 16:54 -0800, Nishanth Aravamudan wrote:
> > Hi,
> > 
> > I'm trying to work some more on auditing the usage of schedule_timeout(),
> > replacing most calls with either msleep() or msleep_interruptible(), depending
> > on the state to sleep in. I am now begginning to replace code outside of drivers
> > and came across arch/ppc64/kernel/{rtc,rtasd,scanlog}.c, all of which use
> > TASK_INTERRUPTIBLE schedule_timeout() calls.
> > 
> > My understand, though, is that TASK_INTERRUPTIBLE directly indicates that one
> > should be able to handle waking up early if a signal is received. I don't see
> > any signal handling / responding in the code around these timeouts. Would
> > TASK_UNINTERRUPTIBLE work in these cases (indicating sleeping for waitqueue
> > events (which I don't see around the code, so I'm guessing means an absolute
> > sleep). If the latter, then perhaps I can use msleep_interruptible(). If you
> > only wish to sleep until a signal is received (or the timeout occurs) then
> > msleep_interruptible() may be a valid choice.
> > 
> > Please let me know what you think.
> >From my experience, there's also a side effect of using UNINTERRUPTIBLE,
> which is that your sleep time gets counted as load in the loadavg. In
> the case of a kernel thread that don't do signals and need to pop up
> regulary, it's best to use INTERRUPTIBLE after making sure all signals
> are blocked.

It seems to me, though, that if you really don't want to deal with signals & you
really intend to sleep the full second (in rtasd.c, for instance), then it makes
perfect sense to use TASK_UNINTERRUPTIBLE (i.e. msleep). Yes it will count to
loadavg, but that doesn't mean the code is wrong (maybe the calculation of
loadavg is incorrect?). Because the only the thing the task is doing in
TASK_UNINTERRUPTIBLE is doing is sleeping. Meaning that while loadavg may go up
(by 1 for each TASK_UNINTERRUPTIBLE task?), the CPU stays at idle.

I would like more input, definitely.


More information about the Linuxppc64-dev mailing list