From owner-freebsd-current@FreeBSD.ORG Mon Dec 2 11:45:58 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60110C12; Mon, 2 Dec 2013 11:45:58 +0000 (UTC) Received: from mail-la0-x236.google.com (mail-la0-x236.google.com [IPv6:2a00:1450:4010:c03::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 208AD1CE7; Mon, 2 Dec 2013 11:45:56 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id b8so2107915lan.13 for ; Mon, 02 Dec 2013 03:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vX313e18J9aw/XnxvVPUlETDS0/4b/gcKO+9Hem8Q6g=; b=BJsCbZajKAUpeNeIFQ3Jb3izcl56KP4rNuYRW1egj4kOaFQ+dJ8PjDz3las5sIebAI 8HXmz9ujfR5ilGahZdQk8/EYLIheuPcBHKtEFNL6/lYYLVunJ6i6H47ehHypwSeZdiyJ kQ31KxAu+7oo5IBInrUw2qlZfvOOe3HoprWYYSCPP9cOyxCYkbnc1EigYR22cOsxfiEh Gw8Zmv0bAKA0n9+Rubi2Ck7UJQGuhdjogql3zow2q4MDZdxaPIzm2LGrv1yXDlgbrbEC f4KJrQRFtvkFpo94KMNFKwmxyf2OlNK2CXa0Em4VqK9kXaFmPYIvEj1BNAYrMjOdTb20 t0xw== MIME-Version: 1.0 X-Received: by 10.152.140.193 with SMTP id ri1mr45245856lab.18.1385984754969; Mon, 02 Dec 2013 03:45:54 -0800 (PST) Received: by 10.114.166.163 with HTTP; Mon, 2 Dec 2013 03:45:54 -0800 (PST) In-Reply-To: References: <4053E074-EDC5-49AB-91A7-E50ABE36602E@freebsd.org> Date: Mon, 2 Dec 2013 19:45:54 +0800 Message-ID: Subject: Re: [PATCH] SO_REUSEADDR and SO_REUSEPORT behaviour From: Sepherosa Ziehau To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: =?ISO-8859-1?Q?Ermal_Lu=E7i?= , freebsd-net , Oleg Moskalenko , Tim Kientzle , "freebsd-current@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2013 11:45:58 -0000 On Mon, Dec 2, 2013 at 1:02 PM, Adrian Chadd wrote: > Hi! Thanks for the writeup! > > On 1 December 2013 20:17, Sepherosa Ziehau wrote: > > > I also put up a brief description of SO_REUSEPORT in dfly; may be useful > to > > you: > > http://leaf.dragonflybsd.org/~sephe/netisr_so_reuseport.txt > > Ok, so given this, how do you guarantee the UTHREAD stays on the given > CPU? You assume it stays on the CPU that the initial listen socket was > created on, right? If it's migrated to another CPU core then the > listen queue still stays in the original hash group that's in a netisr > on a different CPU? > > As I wrote in the above brief introduction, Dfly currently relies on the scheduler doing the proper thing (the scheduler does do a very good job during my tests). I need to export certain kind of socket option to make that information available to user space programs. Force UTHREAD binding in kernel is not helpful, given in reverse proxy application, things are different. And even if that kind of binding information was exported to user space, user space program still would have to poll it periodically (in Dfly at least), since other programs binding to the same addr/port could come and go, which will cause reorganizing of the inp localgroup in the current Dfly implementation. Best Regards, sephe -- Tomorrow Will Never Die