Messages in this thread | | | Subject | Re: [PATCH 4/9] AF_UNIX: find the recipients for multicast messages | From | Eric Dumazet <> | Date | Tue, 23 Nov 2010 17:56:40 +0100 |
| |
Hmm, just thought about lockless again, and we had same multicast problem on udp as well.
We are forced to hold a lock (to forbid concurrent deletes), or we might going through one 'about to be removed' socket and abort the iteration in the middle. Some sockets would not receive a copy of the message.
(UDP sockets using SLAB_DESTROY_BY_RCU, we could even have multiple copies sent to some sockets, if the removed socket is re-inserted in front of chain because of instant reuse)
To have a true lockless path, you would need to restart the full scan if you notice a delete was done during the iteration, eventually using a sequence number per chain. That would be expensive, because you have to undo all the socket accumulation (refcount) done during the lookup, before restart the thing.
To avoid starvation, getting a lock at the second iteration would be good ;)
| |