May be I shall share what I heard about might_sleep(), but have not got the time to further analyse: Read this (Ingo's solution): http://kerneltrap.org/node/3440 On Fri, Aug 1, 2008 at 4:41 PM, Prasad Joshi <prasadjoshi124@xxxxxxxxx> wrote: > Hi All, > > Here is the code for __do_clear_user, I am not getting how does it work. Can > any one please explain? > > #define __do_clear_user(addr,size) \ > do { \ > int __d0; \ > might_sleep(); \ First, is the need to make the kernel more interactive, or shortening its latency in responding to external events (eg, interrupts). To do is quite simple, but tedious: just go to every part of the kernel, and insert the schedule() (or its equivalent of yielding the CPU). But there are rules to follow when doing this, for example, u cannot call schedule() while holding a spinlock. (so sometimes u see patches inserting a might_sleep() just before the spinlock statement: http://readlist.com/lists/vger.kernel.org/linux-kernel/9/45309.html ) So, how to do this in the fastest manner? Ingenious solution was thought of: insert these into might_sleep(). So now might_sleep() will in fact attempt to switch the tasks to another item on the waiting queue. Latency reduced, and the kernel become more interactive. -- Regards, Peter Teoh -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ