CVSROOT: /cvs Module name: src Changes by: d...@cvs.openbsd.org 2025/08/19 21:55:37
Modified files: sys/net : rtsock.c Log message: replace the SRPL used to protect the list of rtsocks with an rwlock. this code uses an SPRL to manage the list of rtsocks that route messages can be "recved" on. the obvious replacement would be an SMR list, but while you shouldn't sleep with an SRP ref, we do here, and you can't do that inside an SMR read critical section. to avoid the sleep while in the SMR crit section, i'd have to add refcnt operations, which means a bunch of atomic ops. alternatively, we could do what i did with the ethernet sockets and use an rwlock to protect the list of sockets, and take a read lock while traversing the list. this reduces the overall number of atomic ops and keeps the code in the recv loop much the same. the downside is we have to be careful about lock ordering now. the recv path takes the list lock, and then the socket lock for queueing the messages. the socket setup and destroy code has the socket lock and wants to take the rwlock, so it needs to be careful and drop the socket lock first. ok jmatthew@ claudio@