Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2944299ybj; Mon, 23 Sep 2019 12:00:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1yKFlScUOMDihP6zAKPGAPaTI5bY6be8u2DCXnlwP799u5NsNMpKic2lLz4SRQJvLj/g+ X-Received: by 2002:aa7:c616:: with SMTP id h22mr1705076edq.96.1569265221712; Mon, 23 Sep 2019 12:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569265221; cv=none; d=google.com; s=arc-20160816; b=TN337yBbZvKrOvSrLnEUVFT9V7XXgzeX3CV01OfpAXpc+Y3dzPC+DPRM30ytcmE9d/ u0K5DncYEFVVRdU6mKLpCKLbGVaaO8c7eN8c2v4qo6I1rltKKZkbHHq3bhDJRnexNfGy m+dcISNRR+E9yIMW+DjyTDrS4IYGZj2eZTgOnTHnoGSI9BRCkXLDvEMrRfMw/TTsEnbM frMKSlSf5fdPCQq5i4R8Qfq35uWyVyVcwruiwCxVjimfMS42zgSLIf1i8r+NfYWw6C+z LKRNU6sjPNjzpKn+kqzEB8iiGnGbHg9chdwzjTYqHQGaO/RVQgE4bTFjfa3UZcf84IuB UE2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MdyoI0wk0OHhp3NdhEsxRy8OuPbdRl6iNSJ7ObkMYeE=; b=xgx9+o4w7eLtQxz5gOqkZ2UZ2sVRkKAdaMHcM8n/Fcscck5lSAF+XEmya1MMRLNfxp JfYru7I3mUamMzJfduo/0Aw6qZDkEC7EjQn3Uc/RzeeBaQOCx1j0sVFlKKZ6zfqHIO9B KtLq71rkjE/JXsEIc/D1S+n0Vy6ipOF9NAnj9TsrByD8Q+EDGHsfXOPcqDYyd2oImu8I mlPLChFmNx771LxwMO14qTbSZ3B/qzSs5x/Uul+8uJA1AGbwTfrs7ThTpjs2Jla2QDe3 xP/woTQAzrfSrirkRLiAXBfccjxzbXKzhqLMIkQulPBl5akDvoxE9M9PzpNtmmnGKv0V kXqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si5555008ejw.108.2019.09.23.11.59.58; Mon, 23 Sep 2019 12:00:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726205AbfIUUck (ORCPT + 99 others); Sat, 21 Sep 2019 16:32:40 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:57752 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfIUUck (ORCPT ); Sat, 21 Sep 2019 16:32:40 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id DCD22807C7; Sat, 21 Sep 2019 22:32:23 +0200 (CEST) Date: Sat, 21 Sep 2019 22:32:37 +0200 From: Pavel Machek To: pavel@denx.de Cc: linux-kernel@vger.kernel.org, Willem de Bruijn , Paolo Abeni , Craig Gallek , "David S. Miller" Subject: Re: [PATCH 4.19 10/79] udp: correct reuseport selection with connected sockets Message-ID: <20190921203237.GB14868@amd> References: <20190919214807.612593061@linuxfoundation.org> <20190919214808.734045565@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+pHx0qQiF2pBVqBT" Content-Disposition: inline In-Reply-To: <20190919214808.734045565@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --+pHx0qQiF2pBVqBT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2019-09-20 00:02:55, Greg Kroah-Hartman wrote: > From: Willem de Bruijn >=20 > [ Upstream commit acdcecc61285faed359f1a3568c32089cc3a8329 ] >=20 > UDP reuseport groups can hold a mix unconnected and connected sockets. > Ensure that connections only receive all traffic to their 4-tuple. >=20 > Fast reuseport returns on the first reuseport match on the assumption > that all matches are equal. Only if connections are present, return to > the previous behavior of scoring all sockets. >=20 > Record if connections are present and if so (1) treat such connected > sockets as an independent match from the group, (2) only return > 2-tuple matches from reuseport and (3) do not return on the first > 2-tuple reuseport match to allow for a higher scoring match later. >=20 > New field has_conns is set without locks. No other fields in the > bitmap are modified at runtime and the field is only ever set > unconditionally, so an RMW cannot miss a change. That's an ... extremely tricky game with concurrent access. I'm pretty sure it is not valid C, but maybe it is acceptable for kernel. > --- a/include/net/sock_reuseport.h > +++ b/include/net/sock_reuseport.h > @@ -21,7 +21,8 @@ struct sock_reuseport { > unsigned int synq_overflow_ts; > /* ID stays the same even after the size of socks[] grows. */ > unsigned int reuseport_id; > - bool bind_inany; > + unsigned int bind_inany:1; > + unsigned int has_conns:1; But should it at least be commented here? If someone adds another int :1, he may get a surprise... Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --+pHx0qQiF2pBVqBT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl2GiOUACgkQMOfwapXb+vLb6wCggDl0JjSzuLuVv0oxRREVTOFY Y0EAni8wDVvlrdVRBByQOLaLyoNZa13t =zkuo -----END PGP SIGNATURE----- --+pHx0qQiF2pBVqBT--