Re: [RFC PATCH 2.6.17-mm1 4/3] ieee1394: convert ieee1394_transactionsfrom semaphores to waitqueue
From: Stefan Richter
Date: Sat Jun 24 2006 - 16:41:55 EST
Arjan van de Ven wrote:
On Sat, 2006-06-24 at 19:45 +0200, Stefan Richter wrote:
following semaphores remain in the ieee1394 subsystem:
highlevel.c: hl_drivers_sem (RW semaphore)
nodemgr.c: subsys.rwsem (driver core's RW semaphores)
raw1394.c: fi->complete_sem (completion semaphore)
can this last one move to an actual completion? That would get rid of it
nicely ;)
Hmm. There are dozens of points in raw1394 which call
__queue_complete_req() which up()s the semaphore. ("fi" is the
private_data of a struct file. Multiple outstanding requests may be
associated with a file.) Then there are two places which wait on the
semaphore:
raw1394_read(), called when somebody reads /dev/raw1394:
if (file->f_flags & O_NONBLOCK) {
if (down_trylock(&fi->complete_sem))
return -EAGAIN;
} else {
if (down_interruptible(&fi->complete_sem))
return -ERESTARTSYS;
}
raw1394_release(), called when somebody closes (releases) /dev/raw1394:
done = 0;
while (!done) {
/* free all complete requests */
/* set "done" if there are no more pending requests */
if (!done)
down_interruptible(&fi->complete_sem);
}
/* cleanup, free fi */
It looks like fi->complete_sem is a actually a counting semaphore. It
could perhaps be replaced by a wait queue plus an atomic counter. There
is even already a wait queue in "fi" for use with poll_wait() via
raw1394_poll().
--
Stefan Richter
-=====-=-==- -==- ==---
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/