From owner-freebsd-net@freebsd.org Fri Jan 27 14:38:16 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8770BCC3B00 for ; Fri, 27 Jan 2017 14:38:16 +0000 (UTC) (envelope-from julien.charbon@gmail.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 642BB18E2 for ; Fri, 27 Jan 2017 14:38:16 +0000 (UTC) (envelope-from julien.charbon@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 6384CCC3AFC; Fri, 27 Jan 2017 14:38:16 +0000 (UTC) Delivered-To: net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63298CC3AFA for ; Fri, 27 Jan 2017 14:38:16 +0000 (UTC) (envelope-from julien.charbon@gmail.com) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE6C718E1; Fri, 27 Jan 2017 14:38:15 +0000 (UTC) (envelope-from julien.charbon@gmail.com) Received: by mail-wm0-f67.google.com with SMTP id r144so58739330wme.0; Fri, 27 Jan 2017 06:38:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=WAqoe6+TVwx8XqspomZZNHU1KLKGD4gft28CCFJ9m2o=; b=E8bI++dc1Of9LVR8xnArB8xlhQLuE2iWdEsnG2OwK7tTVQIO4Uk7aB3I7uesO95i9x yrxsHyHjyS+2iPi3eBeRFSSvLdncMkRt90Dvy2eB/xrNxgFfJh2kQINAoQuC/OhVxoKj y2DMcsMsnJwOpFoGFxs2cVb93ekg7wlcvsdxs4lqMeN7wpltbzKaeEVDyQmK1bW+gJ9t 4ubOFxsf6oHkTCitaI4y1/nDzcSUgrXXXzJq/5skSXWijczfGKOoI+EUksUAXXUUGy1K 1nPVuaVlDWXzgqQKxGiJtT5NnYew65ArsM08ocMg5NvtG5IQFsTm6K9wB+ZA5v/tglbs pWCg== X-Gm-Message-State: AIkVDXLmS/hzKIOLwI1nAF1Eg7zfddPHBm3EQ+S5AqG/R+JY4BqxMGXk5a1ScwxXmdNfIw== X-Received: by 10.28.173.74 with SMTP id w71mr3237319wme.14.1485527887944; Fri, 27 Jan 2017 06:38:07 -0800 (PST) Received: from [10.100.64.12] ([217.30.88.44]) by smtp.gmail.com with ESMTPSA id 61sm8191614wrs.29.2017.01.27.06.38.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jan 2017 06:38:06 -0800 (PST) Subject: Re: listening sockets as non sockets To: Gleb Smirnoff , hiren@FreeBSD.org, Jason Eggleston References: <20170127005251.GM2611@FreeBSD.org> Cc: jtl@FreeBSD.org, rrs@FreeBSD.org, net@FreeBSD.org From: Julien Charbon Message-ID: <84f9c348-1e65-1b94-37a6-a4c67d195709@freebsd.org> Date: Fri, 27 Jan 2017 15:37:57 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170127005251.GM2611@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mc4llJNOAcSIKKqbI6nk76vuCmWPKUGma" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 14:38:16 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mc4llJNOAcSIKKqbI6nk76vuCmWPKUGma Content-Type: multipart/mixed; boundary="Bia7XafaO9k9cIeGEGeH9sxqELVnt3SLP"; protected-headers="v1" From: Julien Charbon To: Gleb Smirnoff , hiren@FreeBSD.org, Jason Eggleston Cc: jtl@FreeBSD.org, rrs@FreeBSD.org, net@FreeBSD.org Message-ID: <84f9c348-1e65-1b94-37a6-a4c67d195709@freebsd.org> Subject: Re: listening sockets as non sockets References: <20170127005251.GM2611@FreeBSD.org> In-Reply-To: <20170127005251.GM2611@FreeBSD.org> --Bia7XafaO9k9cIeGEGeH9sxqELVnt3SLP Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi Gleb, On 1/27/17 1:52 AM, Gleb Smirnoff wrote: > as some of you already heard, I'm trying to separate listening socket= s > 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 simultaneousl= y. > Now, if we look at socket API, we see that once a socket underwent tran= sformation > to a listening socket, only 3 regular syscalls now may be called: liste= n(2), > accept(2) and close(2) and a subset of ioctl() and setsockopt() paramet= ers is > accepted. A listening socket cannot be closed from the protocol side, o= nly from > user side. So, listening socket is so different from a dataflow socket,= that > separating them looks architecturally right thing to do. >=20 > The benefits are: >=20 > 1) Nicer code (I hope). > 2) Smaller 'struct socket'. > 3) Having two different locks for socket and solisten, we can try to ge= t rid > of ACCEPT_LOCK global lock. >=20 > The patch is in a very pre-alpha state. It has been run only in my bhyv= e VM. >=20 > It passes regression tests from tools/regression/sockets and tests/sys,= > including the race tests, and including accept filter ones. >=20 > For TCP it passes basic functionality testing, but likely there are sti= ll races > remaining after ACCEPT_LOCK removal. > > I've put current snapshot to Phab, so that you can view it there. The s= nap > patch is also attached to this email. >=20 > https://reviews.freebsd.org/D9356 >=20 > At this moment I'd like to start doing some testing (and doing polishin= g > 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? Good idea, we are (obviously) interested by point #3 (Get rid of ACCEPT global lock) and its connection rate scalability improvement. I might be able to look at potential race conditions related to ACCEPT_LOCK and SO_ACCEPTFILTER usage (even if I am more used to INP_INFO lock), but I can certainly provide performance numbers and lock contention metrics using our setup. Do you think it is the right time to start performance testing with your change? Or it is a bit premature? -- Julien --Bia7XafaO9k9cIeGEGeH9sxqELVnt3SLP-- --mc4llJNOAcSIKKqbI6nk76vuCmWPKUGma Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJYi1tLAAoJEKVlQ5Je6dhxK6cH/2pOgTzT9i1b1nvBbZi82p3D ashJsxwEk/2gLcpDNlwrUL7K7Y/qea0Ah//isO47ZHc3qdZOZm7t9D1mr/hmoS6e BJteTgYvvjhOiCradH8lB1LG6kNg+6vQsjsJ/AovepAonRrKnQl2dj6XgFpKDcHi jCqcBW768lIl3FaW/geVwtACXqAeHMIXvg5ikeVM3MtG22H1mTmumMG8GsGu6QYs zWxXdfL3CFAvyFArfUD+Gv2ng5sItCL3gDvo7KeolpHI0nwL297f4BmYkeuks773 4aAogg9Y3e5GkrxF1l56YA3EGg4mwOvLwhjb3OB0m4lW4R2B0Fx1jTFa76np/Ag= =1tCk -----END PGP SIGNATURE----- --mc4llJNOAcSIKKqbI6nk76vuCmWPKUGma--