freebsd-nq/sys
Matt Macy 75a67bf3d0 AF_UNIX: make unix socket locking finer grained
This change moves to using a reference count across lock drop / reacquire
to guarantee liveness.

Currently sends on unix sockets contend heavily on read locking the list lock.
unix1_processes in will-it-scale peaks at 6 processes and then declines.

With this change I get a substantial improvement in number of operations per second
with 96 processes:

x before
+ after
    N           Min           Max        Median           Avg        Stddev
x  11       1688420       1696389       1693578     1692766.3     2971.1702
+  10      63417955      71030114      70662504      69576423     2374684.6
Difference at 95.0% confidence
        6.78837e+07 +/- 1.49463e+06
        4010.22% +/- 88.4246%
        (Student's t, pooled s = 1.63437e+06)

And even for 2 processes shows a ~18% improvement.
"Small" iron changes (1, 2, and 4 processes):

x before1
+ after1.2
+------------------------------------------------------------------------+
|                                                                  +     |
|                                                           x      +     |
|                                                           x      +     |
|                                                           x      +     |
|                                                           x     ++     |
|                                                          xx     ++     |
|x                                                       x xx     ++     |
|                                  |__________________A_____M_____AM____||
+------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10       1131648       1197750     1197138.5     1190369.3     20651.839
+  10       1203840       1205056       1204919     1204827.9     353.27404
Difference at 95.0% confidence
        14458.6 +/- 13723
        1.21463% +/- 1.16683%
        (Student's t, pooled s = 14605.2)

x before2
+ after2.2
+------------------------------------------------------------------------+
|                                                                       +|
|                                                                       +|
|                                                                       +|
|                                                                       +|
|                                                                       +|
|                                                                       +|
|           x                                                           +|
|           x                                                           +|
|         x xx                                                          +|
|x        xxxx                                                          +|
|      |___AM_|                                                         A|
+------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10       1972843       2045866     2038186.5     2030443.8     21367.694
+  10       2400853       2402196     2401043.5     2401172.7     385.40024
Difference at 95.0% confidence
        370729 +/- 14198.9
        18.2585% +/- 0.826943%
        (Student's t, pooled s = 15111.7)

x before4
+ after4.2
    N           Min           Max        Median           Avg        Stddev
x  10       3986994       3991728     3990137.5     3989985.2     1300.0164
+  10       4799990       4806664     4806116.5       4805194     1990.6625
Difference at 95.0% confidence
        815209 +/- 1579.64
        20.4314% +/- 0.0421713%
        (Student's t, pooled s = 1681.19)

Tested by: pho
Reported by:	mjg
Approved by:	sbruno
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15430
2018-05-17 17:59:35 +00:00
..
amd64 vmmdev: return EFAULT when trying to read beyond VM system memory max address 2018-05-15 17:20:58 +00:00
arm aw_spi: Fix some silly clock mistake 2018-05-17 14:51:22 +00:00
arm64 followup to r332730/r332752: set kdb_why to "trap" for fatal traps 2018-05-16 06:52:08 +00:00
bsm
cam Hold the reference count until the CCB is released 2018-05-15 22:22:10 +00:00
cddl Fix 'zpool create -t <tempname>' 2018-05-15 13:27:29 +00:00
compat Allow freebsd32 __sysctl(2) to return ENOMEM. 2018-05-15 16:24:58 +00:00
conf Retire vxge(4). 2018-05-17 14:55:41 +00:00
contrib Add support for setting type of service, TOS, for outgoing RDMA connections 2018-05-15 07:46:24 +00:00
crypto opencrypto: Integrate Chacha20 algorithm into OCF 2018-03-29 04:02:50 +00:00
ddb Fix PPC symbol resolution 2018-05-10 03:59:48 +00:00
dev Fix build if USB_DEBUG is defined. 2018-05-17 17:57:41 +00:00
dts arm: overlays: Update to new path-based sugar format 2018-05-04 14:38:48 +00:00
fs Revert change made in base r171522 2018-05-16 23:30:03 +00:00
gdb amd64: Protect the kernel text, data, and BSS by setting the RW/NX bits 2018-03-06 14:28:37 +00:00
geom Introduce the 'n' flag for the geli attach command. 2018-05-09 20:53:38 +00:00
gnu gnu/dts: Update our copy of arm dts from Linux 4.16 2018-04-20 19:37:08 +00:00
i386 Fix PMC_IN_TRAP_HANDLER() for i386 after the 4/4 split. 2018-05-13 20:10:02 +00:00
isa Revert r330780, it was improperly tested and results in taking a spin 2018-03-11 20:13:15 +00:00
kern AF_UNIX: make unix socket locking finer grained 2018-05-17 17:59:35 +00:00
kgssapi kgssapi: Remove trivial deadcode 2018-02-14 00:12:03 +00:00
libkern Remove "All rights reserved" from my files. 2018-05-10 06:41:08 +00:00
mips Include kernel modules for MALTA kernels. 2018-05-16 17:54:40 +00:00
modules Retire vxge(4). 2018-05-17 14:55:41 +00:00
net Fix !netmap build post r333686 2018-05-16 22:25:47 +00:00
net80211 Use an accessor function to access ifr_data. 2018-03-30 18:50:13 +00:00
netgraph Correct pseudo misspelling in sys/ comments 2018-02-23 18:15:50 +00:00
netinet Fix netdump configuration when VIMAGE is enabled. 2018-05-17 04:08:57 +00:00
netinet6 Unwrap some not-so-long lines now that extra tabs been removed. 2018-05-15 17:59:46 +00:00
netipsec Merge r1.22-1.23 from NetBSD: 2018-04-26 12:23:31 +00:00
netpfil Bring in some last changes in NAT64 implementation: 2018-05-09 11:59:24 +00:00
netsmb Eliminate the overhead of gratuitous repeated reinitialization of cap_rights 2018-05-09 18:47:24 +00:00
nfs Remove support for FDDI networks. 2018-04-11 17:28:24 +00:00
nfsclient
nfsserver
nlm Use syscall_helper_register() to register syscalls and initialize though 2018-02-10 01:09:22 +00:00
ofed Improve copy-and-pasted versions of SIOCGIFADDR. 2018-03-27 20:51:49 +00:00
opencrypto cryptosoft: Do not exceed crd_len around *crypt_multi 2018-04-19 15:24:21 +00:00
powerpc Final fix for alignment issues with the page table first patched with 2018-05-14 04:00:52 +00:00
riscv Export a breakpoint() function to userland for riscv. 2018-05-16 16:56:35 +00:00
rpc
security Use an accessor function to access ifr_data. 2018-03-30 18:50:13 +00:00
sparc64 Report TRAP_BRKPT for breakpoint traps on sparc64. 2018-05-09 15:25:26 +00:00
sys AF_UNIX: make unix socket locking finer grained 2018-05-17 17:59:35 +00:00
teken teken: Unbreak syscons' use of teken 2018-05-16 18:12:49 +00:00
tests Test priority handling in epoch test. 2018-05-11 04:47:05 +00:00
tools Add dtb overlays support 2018-03-24 21:30:24 +00:00
ufs Fix warning found by Coverity. 2018-05-16 23:42:02 +00:00
vm Fix a race in vm_page_pagequeue_lockptr(). 2018-05-17 04:27:08 +00:00
x86 fix a problem with bad performance after wakeup caused by r333321 2018-05-17 10:16:20 +00:00
xdr
xen xen: fix gntdev 2018-05-02 10:19:17 +00:00
Makefile