红联Linux门户
Linux帮助

Linux device driver note

发布时间:2008-02-29 10:40:59来源:红联作者:Nesoikps
From now on, I must record all of the useful notes of Linux, especially about device driver, the following is the first.

It is about how to reschedule the processor in a device driver. What should be aware while calling function schedule().


You can prevent an endless loop inserting schedule invocations at strategic points. The schedule

call (as you might guess) invokes the scheduler and, therefore, allows other processes to steal CPU

time from the current process. If a process is looping in kernel space due to a bug in your driver, the

schedule calls enable you to kill the process after tracing what is happening.

You should be aware, of course, that any call to schedule may create an additional source of reentrant

calls to your driver, since it allows other processes to run. This reentrancy should not normally be a

problem, assuming that you have used suitable locking in your driver. Be sure, however, not to call

schedule any time that your driver is holding a spinlock.
文章评论

共有 0 条评论