On 24/11/21(Wed) 15:04, Vitaliy Makkoveev wrote:
> [...] 
> Really, this is the simplest way. The shared lock for the pair of
> sockets moves re-lock dances to the connect and disconnect stages which
> should be also protected by locks. And not for the pair. Many SOCK_DGRAM
> sockets could be connected to one socket. This could be done, but this
> is the hell. And there is absolutely NO profit.

It's not clear to me why sharing a lock isn't simpler.  Currently all
unix(4) sockets share a lock and the locking semantic is simpler.

If two sockets are linked couldn't they use the same rwlock?  Did you
consider this approach?  Is it complicated to know which lock to pick?

This is what is done in UVM and that's why the rwlock is allocated outside
of "struct uvm_object" with rw_obj_alloc().  Having a 'rwlock pointer' in
"struct socket" could also help by setting this pointer to &netlock in the
case of UDP/TCP sockets. 

I'm not saying your approach isn't working.  I'm just not convinced it is
the simplest path forward and I wish we could do without refcounting.

Reply via email to