From nobody Wed Dec 15 05:50:12 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 C8E5618F0FCC; Wed, 15 Dec 2021 05:50:24 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 4JDPV83lS9z3QHh; Wed, 15 Dec 2021 05:50:24 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 5B4B1A22C; Wed, 15 Dec 2021 05:50:24 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f175.google.com with SMTP id l25so9737035qkl.5; Tue, 14 Dec 2021 21:50:24 -0800 (PST) X-Gm-Message-State: AOAM530Je7o+SeugVA57rgKRswtOzUnvCRDl+xR5E+4F2yU7m83EyIjt OVV56PC3gdJWv8qp84gfU8zikFhidroRNoMKX+8= X-Google-Smtp-Source: ABdhPJx/VL4g29oBMG5HyRBbqJMf8na84vL40fPKGiYbZBPbVviNLqGNq5iKRXRu18rRiRT2hDCSidVqYXD7P+AV4gI= X-Received: by 2002:a05:620a:f0e:: with SMTP id v14mr4656193qkl.365.1639547423745; Tue, 14 Dec 2021 21:50:23 -0800 (PST) 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 References: <202112051847.1B5Il2GP030287@gitrepo.freebsd.org> <28AE53F1-2B22-444B-B1EC-1600FA741FE2@FreeBSD.org> In-Reply-To: From: Kyle Evans Date: Tue, 14 Dec 2021 23:50:12 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: eb93b99d6986 - main - in_pcb: delay crfree() down into UMA dtor To: Mark Johnston Cc: Kristof Provost , Gleb Smirnoff , src-committers , "" , dev-commits-src-main@freebsd.org 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=1639547424; 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=k+PDyo8jjAoItkbVyAUtlhoZWTyH6vT9mq5YLGQxZ60=; b=wcIzsFDvI1Cd8SiYQj1mVAxPJGSgWHMfXvW/mQHk1/JmtspK6eol10zK9imPqDrPexyc7Z iajuYf9QjWD4pv2jQ/f65k4RSJl94D9mECUUEoWCjYLklE6gbNGHObAN+fn1QF+mzdeNO/ tL4rv1af6osBnoMJumPGnaEMxcyC5a1K9ZwJiRnHJ9qFu2qqdezFKVbv36IVBhRb/Kb8fv tAh28XwXFUi+/zaedb0qp9LuAQgGGowNxQnvVU54oD2XZR/8WWD3xSYzVPQiiOHqLHJXWS +YvZljVhHjaeX8yJqcwLLAj20WHhSMA/1120rSbqAz+N7yWLN1PsCc3uCY54bg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639547424; a=rsa-sha256; cv=none; b=WYHWwm3CL0slyV4YL3yKHUomXbQa0rQXRqVMSCHxoJJ0ag6c3r7u3hEEWPehvwLeehvaJN c/L2Als2KfSAWrmrQxQML4x0foTHOpTt7mRg05qfcaIlilw52pqa5A9q45yHeyVe1bWH2t co5QrDeeEIpbGruVL1WWJuF3uSrXTNFBm/7Rs1iHHTXO3yrjYPRPn7j4OZid/J1ucm66FJ Dq1llCuCe0eDM2SCMBgok5MFr4u0fL8F7zPwfyNd6fD6U9a2IOzbiGaXrXo7UVxxTcuWPJ RFj3VfClyy9Q7xZonBwPSe/4uxNPGc38qDZCIkQVa/wo7uME5S3+kwnuIlGR5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Tue, Dec 14, 2021 at 8:35 PM Mark Johnston wrote: > > On Tue, Dec 14, 2021 at 10:42:49PM +0100, Kristof Provost wrote: > > On 5 Dec 2021, at 19:47, Gleb Smirnoff wrote: > > > The branch main has been updated by glebius: > > > > > > URL: > > > https://cgit.FreeBSD.org/src/commit/?id=3Deb93b99d698674e3b1cc7139fda= 98e2b175b8c5b > > > > > > commit eb93b99d698674e3b1cc7139fda98e2b175b8c5b > > > Author: Gleb Smirnoff > > > AuthorDate: 2021-12-05 16:47:24 +0000 > > > Commit: Gleb Smirnoff > > > CommitDate: 2021-12-05 18:46:37 +0000 > > > > > > in_pcb: delay crfree() down into UMA dtor > > > > > > inpcb lookups, which check inp_cred, work with pcbs that > > > potentially went > > > through in_pcbfree(). So inp_cred should stay valid until SMR > > > guarantees > > > its invisibility to lookups. > > > > > > While here, put the whole inpcb destruction sequence of > > > in_pcbfree(), > > > inpcb_dtor() and inpcb_fini() sequentially. > > > > > > Submitted by: markj > > > Differential revision: https://reviews.freebsd.org/D33273 > > > > > > > For some reason it looks like this commit causes jails to fail to get > > fully cleaned up. > > I can reproduce that trivially with `cd /usr/tests/sys/net ; kyua test > > if_bridge_test:bridge_transmit_ipv4_unicast ; jls -na`. > > > > Note the jails in dying state. > > > > The jails created by that test never go away. It=E2=80=99s as if > > `crfree(inp->inp_cred);` doesn=E2=80=99t actually get called. And indee= d, it > > looks like inpcb_dtor() does not get called at all. > > For SMR zones it won't get called until there's some attempt to reuse a > bucket. There's a fairly tight bound on this in the sense that there > can't be a large number of freed items waiting for the dtor to be > invoked, so the amount of consumed memory should be small, but there's > no bound on how long one might have to wait. I didn't realize that jail > destruction could block waiting for a ucred reference to vanish. > Right, we ran into this problem with wireguard-freebsd, as well; oftentimes, a ucred will be the last prison ref, so we had to hook jail's osd remove method and more aggressively purge wg interfaces that'd otherwise be keeping it alive. > When I tried this patch with poudriere on a large system there was no > problem, but the regression test suite is a different story. I'm not > sure how best to fix this yet. >