Re: [linux-usb-devel] [PATCH 1/9] USB usbfs: take a reference tothe usb device

From: Alan Stern
Date: Sun Apr 18 2004 - 09:42:36 EST


On Sun, 18 Apr 2004, Duncan Sands wrote:

> > > gives correctness, but at the cost of a probable performance hit. In
> > > later steps we can (1) turn dev->serialize into a rwsem
> >
> > Rwsems are _slower_ in the normal case of no contention.
>
> Right, but remember that dev->serialize is per device, not per interface. So if two
> programs grab different interfaces of the same device using usbfs, or if multiple
> threads in the same program beat on the same interface, then they could lose time
> fighting for dev->serialize when in fact they could run in parallel. Personally I doubt
> it matters much, but since most of usbfs only requires read access to the data structures
> protected by dev->serialize, it seems logical to use a rwsem.

There was a lengthy discussion about this a few months ago. On the whole,
people felt that using an rwsem wasn't a good idea.

Personally, I think that contention for a single device will be very rare,
so we don't need to consider it and can leave things as they are.

Alan Stern

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