Messages in this thread | | | Date | Thu, 1 Sep 2005 14:09:19 -0400 (EDT) | From | Alan Stern <> | Subject | Whither klists? |
| |
Patrick and Greg:
To put it baldly: Should klists be replaced with regular lists, each protected by an rwsem (or even a mutex)?
The advantage of klists is that threads can remove or add nodes while other threads iterate through the list. With an rwsem, only one thread would be able to add or remove a node at a time, and only when no other thread was using the list. Considering that klists are currently used to hold:
the set of all devices on a bus,
the set of all drivers for a bus, and
the set of all children of a device,
(not counting the set of all devices bound to a driver, since there's already a patch to replace that with a mutex-protected regular list)
this limitation on adding or removing doesn't seem significant. There aren't many places where these lists are iterated over or altered. We could remove most of the overhead associated with klists and get rid of an extra API for people to learn.
Note that this would be very different from the old bus subsystem rwsem. That protected too much -- everything associated with the bus subsystem -- making it a pronounced chokepoint. My suggestion involves a separate rwsem for each of these lists, so that none of them would be subject to much contention.
Alan Stern
- 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/
| |