Messages in this thread | | | Date | Sat, 24 Jun 2006 22:28:58 +0200 | From | Stefan Richter <> | Subject | Re: [RFC PATCH 2.6.17-mm1 4/3] ieee1394: convert ieee1394_transactions from semaphores to waitqueue |
| |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |