[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20070416175551.GB9314@arun.site>
Date: Mon, 16 Apr 2007 23:25:51 +0530
From: Milind Arun Choudhary <milindchoudhary@...il.com>
To: Kernel Janitors <kernel-janitors@...ts.osdl.org>
Cc: Kernel Newbies <kernelnewbies@...linux.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [KJ]use mutex instead of a binary semaphore
As the new mutex primitive is now in place, I read,it is advised
not to use binary semaphore for mutual exclusion.
while looking at different place where a binary semaphore is initialized,
I came accross bd_mount_sem.
I read a thread on LKML few months back related to the bd_mount_sem
and realized that there are cases where a binary semaphore can not be replaced by a mutex.
The reason being mutex has a sense of ownership, i.e.
a mutex can only be unlocked from the context
from which it was locked.
e.g bd_mount_sem in the block device structure is
used to make sure no new mounts happen on bdev
in between freeze_bdev and thaw_bdev().
so locking is done in freeze_bdev &
unlocking in thaw_bdev these can be from different context i guess..
is my understandig correct..
CMIIW..
would appreciate some pointers on how to identify such cases..
--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists