Hello all,

Why would a linux driver call "schedule()" ?

The LDD proposes this method to fight systems hangs caused by an infinite loop 
in the driver. In this
case the "schedule()" call would be a workaround. I think better fix the 
infinite loop and abstain to call
schedule()...

I found more than 300 cases divers of the latest LK are calling schedule. Looks 
to me more like a 
necessity than a workaround. The following example is cut from 
"drivers/parport/parport_pc.c"

                if (need_resched() &&
                    time_before(jiffies, expire)) {
                    schedule();
                }
    
The "need_resched()" call is a kernel inline function. Would this mean that 
linux drivers should check
this flag and graciously concede the CPU when asked for?

Thanks sharing your opinion/knowledge on this,

Stephan.

LDD = Linux Device Drivers (book)
LK = Linux Kernel.

Reply via email to