Re: mutex unlock order

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

 



Hi...

On Thu, Dec 9, 2010 at 19:46, Leon Woestenberg
<leon.woestenberg@xxxxxxxxx> wrote:
> Hello,
>
> On Thu, Dec 9, 2010 at 7:49 AM, Michael Blizek
> <michi1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Why not do this, i.e. acquire the locks in the other order, then
> release the global lock first:
>
> mutex_lock(small_lock);
> mutex_lock(&global_lock);
> do_something_small_which_requires_both_locks();
> mutex_unlock(&global_lock);
> do_something_big_which_requires_only_small_lock();
> mutex_unlock(small_lock);

I second this idea...but Michael said the order of lock grab can not
be changed...

thus I wonder, why? and also, is it possible to use more fine grained
lock...which is specific to both task, thus decreasing "lock grab
interval"?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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