From nobody Wed Dec 15 09:47:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B536118D6C25; Wed, 15 Dec 2021 09:47:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JDVm14Tfjz4cYb; Wed, 15 Dec 2021 09:47:45 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id F39DDCC07; Wed, 15 Dec 2021 09:47:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id EB28D23C2B; Wed, 15 Dec 2021 10:47:42 +0100 (CET) From: Kristof Provost To: Gleb Smirnoff Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: eb93b99d6986 - main - in_pcb: delay crfree() down into UMA dtor Date: Wed, 15 Dec 2021 10:47:42 +0100 X-Mailer: MailMate (1.14r5852) Message-ID: In-Reply-To: References: <202112051847.1B5Il2GP030287@gitrepo.freebsd.org> <28AE53F1-2B22-444B-B1EC-1600FA741FE2@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639561666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ucKCBBC1Z9PT0o0gi4OIQoUtjB4Mmyk+zJ0+4NnuOm0=; b=tP+KBzqFMDAgWOTN7aChciPiRgjFPf07kcqamCOBwRCiZcqIEJ7HUfj5zBI5SYCgTwdNja gdWMLSNFvkDGlq87jZE54760y9cJrjyPNugfFDNF/RLHeAGKix0D6xzO3odc/t4+akI6K/ uTkpU4ZnWzeisK3b1hsJ1valhTFvs80TxZq12RiAiE35U4uSZDNxhzuZiDJMR+rkss67On sYmvd17hWL4QH/sHhKZOfOGaVxDCLt1QBp4Rb/AFi2uADeG2KKaPRXUFvSw57CQj6xsv16 3/gWe5qfOe8XGyn5ONktvdDctgGIJ1MU8Ev8dGPdcuKis71mHBZElIBX6ItfAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639561666; a=rsa-sha256; cv=none; b=wN/9LMGDyPpaVQ6uMjHqcM9mVq06lKQg/CnGJSqkdV2f0WrAJVqs+0/2lvl6HVMnSvCCt3 KPFwGHI2qSPMAvOubphVhg3nddRwCR+InNy/RuFKbMxe6csXX8i5nse+yjJGgeEx4h0uWl tiu4wq2Dq9RlNTO2R79gG6l6bhb9GlRJrQA9L0eRdujXChFfmKX5tfz8rQdTvvG2iQPA4r ky1Es/pf41/BuMZR7HdmDrHJdwyHWwyBtkAvhDGDZ16GrZNDoqT8siEAunCvFJ66njiKBT XVVHa1lXtccUJ8OnwBE2MtHL3Rq7rhFXQJcgy6zL5O8EYtu4k1SXD4V4Gvvv3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 15 Dec 2021, at 6:58, Gleb Smirnoff wrote: > On Tue, Dec 14, 2021 at 10:42:49PM +0100, Kristof Provost wrote: > K> > in_pcb: delay crfree() down into UMA dtor > K> > > K> > inpcb lookups, which check inp_cred, work with pcbs that > K> > potentially went > K> > through in_pcbfree(). So inp_cred should stay valid until SMR= > K> > guarantees > K> > its invisibility to lookups. > K> > > K> > While here, put the whole inpcb destruction sequence of > K> > in_pcbfree(), > K> > inpcb_dtor() and inpcb_fini() sequentially. > K> > > K> > Submitted by: markj > K> > Differential revision: https://reviews.freebsd.org/D33273 > K> > K> For some reason it looks like this commit causes jails to fail to ge= t > K> fully cleaned up. > K> I can reproduce that trivially with `cd /usr/tests/sys/net ; kyua te= st > K> if_bridge_test:bridge_transmit_ipv4_unicast ; jls -na`. > K> > K> Note the jails in dying state. > K> > K> The jails created by that test never go away. It=E2=80=99s as if > K> `crfree(inp->inp_cred);` doesn=E2=80=99t actually get called. And in= deed, it > K> looks like inpcb_dtor() does not get called at all. > > Yes, I faced this problem today, too. :( > > My radical opinion is that per-VNET pcb zones should just be eliminated= =2E > The only thing they serve is imposing maxsockets limit separately for > each VNET. But we already have the maxsocket limit on the socket zone, > which is _global_! > > Anybody to explain me the sense of the per-VNET per-pcb zone limit > set to the same maxsockets value? You can't create a pcb without a > socket, which is guaranteed by the in_pcballoc() prototype. Of course > I understand that pcbs may outlive the socket. But those pcbs that > outlive a socket, are eventually garbage collected as their lifetime > is finite. Anyway jail/VNET was never declared as a resource management= > framework anyway! > rctl(8) does appear to support per-jail resource limits, but I=E2=80=99m = not sure how complete or functional that is. I don=E2=80=99t really have any strong feelings either way. > So, for this particular problem I would suggest just eliminate per-VNET= > pcb zones, but in general the fact that idle SMR zone may never purge > its cache sucks and needs improvement. > Yeah, that=E2=80=99s certainly going to need some love at some point. Kristof