Schedule() call in driver context.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux