RE: Mutex and Sleep

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

 




-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx
[mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Andrea Gasparini
Sent: Tuesday, July 17, 2007 1:53 PM
To: kernelnewbies@xxxxxxxxxxxx
Subject: Re: Mutex and Sleep

Rajendra Stalekar spiffera, alle Tuesday 17 July 2007 circa:
> which implies that if no lock is acquired it would sleep till it gets
> it.

I think you're quite confused, and that's a bad thing if you make confused 
other people.

>> 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.

1) migth_sleep doesn't have anything to do with mutex, if you control it's 
defined in kernel/sched.c:7101 (kernel 2.6.21.1).
it only tells if that call is in a context that is allowed to sleep, but 
DON'T sleep.

2) the function that "sleep" in this case is the mutex itself. 
if you go through the function calls, you see that you arrive in 
mutex_lock_common, that has a 
for (;;) {... acquire code ... }
that at near end calls schedule() that _can_ sleeps... :P

Bye!
-- 
-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


[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