lkml.org 
[lkml]   [2006]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

\
 
 \ /
  Last update: 2006-06-24 22:35    [W:0.066 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site