listening sockets as non sockets
Gleb Smirnoff
glebius at FreeBSD.org
Fri Jan 27 00:52:53 UTC 2017
Hi guys,
as some of you already heard, I'm trying to separate listening sockets
into a new file descriptor type. If we look into current struct socket,
we see that some functional fields belong to normal data flow sockets,
and other belong to listening socket. They are never used simultaneously.
Now, if we look at socket API, we see that once a socket underwent transformation
to a listening socket, only 3 regular syscalls now may be called: listen(2),
accept(2) and close(2) and a subset of ioctl() and setsockopt() parameters is
accepted. A listening socket cannot be closed from the protocol side, only from
user side. So, listening socket is so different from a dataflow socket, that
separating them looks architecturally right thing to do.
The benefits are:
1) Nicer code (I hope).
2) Smaller 'struct socket'.
3) Having two different locks for socket and solisten, we can try to get rid
of ACCEPT_LOCK global lock.
The patch is in a very pre-alpha state. It has been run only in my bhyve VM.
It passes regression tests from tools/regression/sockets and tests/sys,
including the race tests, and including accept filter ones.
For TCP it passes basic functionality testing, but likely there are still races
remaining after ACCEPT_LOCK removal.
For SCTP the patch is unfinished yet. The tricky thing with SCTP is that it
can un-listen a listening socket back to normal socket, doing listen(fd, 0)
on it. My patch has API for that I started working on SCTP, but temporarily
put this problem aside. It looks solvable, but I don't know yet how to test
it. Better first see results with TCP.
I've put current snapshot to Phab, so that you can view it there. The snap
patch is also attached to this email.
https://reviews.freebsd.org/D9356
At this moment I'd like to start doing some testing (and doing polishing
in parallel), and here I seek for your help. Those, who run FreeBSD at
very high connection rates and observe contention on the accept global
mutex, anybody willing to collaborate with me on this?
--
Totus tuus, Glebius.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solisten.diff
Type: text/x-diff
Size: 124590 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20170126/9a90692a/attachment-0001.diff>
More information about the freebsd-net
mailing list