-----Original Message----- From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Andrea Gasparini Sent: Tuesday, July 17, 2007 2:46 PM To: kernelnewbies@xxxxxxxxxxxx Subject: Re: Mutex and Sleep Hi Rajendra, > Thanks for the clarification , however I have source code of kernel > 2.6.21.5 and if u check that kernel/mutex.c on line no. 86 u will find > that it does have might_sleep function being called. This function is > called in void inline fastcall __sched mutex_lock(struct mutex* ) > function, a complete description of what it does is given just above > this function. Let me know where else can I find mutex_lock function in > that case. i can't catch very well your problem... you can't call mutex_lock() in a context that can't sleep, for example (trivial) in a interrupt context, and this is the problem of the first post. And in particular, inside mutex_lock() function you have only two line: 1) might_sleep() that tells "BUG blabla" if you are in a context that can't sleep. As said, this function DOESN'T sleeps. This function is called everywhere you want to control if the context if correct. you can easily grep it in kernel/* files... And isn't a particular function of mutexes, but a general function exported by the kernel scheduler. Rajendra :- Andrea, yes I got that , but what is the purpose in having the might_sleep function then? 2) __mutex_fastpath_lock(&lock->count, __mutex_lock_slowpath); that make the control of the mutex, try to acquire it and calls schedule otherwise. THIS is the part that sleeps. if i wasn't clear, try to explain better your issue. -- -gaspa- ----------------------------------------------- --------- Powered by Debian GNU/Linux --------- ------ HomePage: iogaspa.altervista.org ------- -Il lunedi'dell'arrampicatore: www.lunedi.org - -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ