From nobody Wed Dec 15 02:35: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 013BB18EDCEB; Wed, 15 Dec 2021 02:35:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JDK9Z6KQmz4ZXb; Wed, 15 Dec 2021 02:35:46 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x734.google.com with SMTP id m192so18717322qke.2; Tue, 14 Dec 2021 18:35:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=dwbtyS06YkW0qRsH94vEFI4tkESpQd2SvHtOqpt4cB0=; b=cX7/uvcaij6R/jXJs8wHbpIyJnuAd9RzwsC+flnVDXD4c6QsxUnZCsStltpvfejykh F+pA3AAraztHnvHTLzFmkGptBU7vM6G1q9taN9/7EyHzzxHNc37413fLKmjv6nsCT8aP eOZ3FBwC2iV3LRtWUCHYjKa5KvzKrc/Tr1EFJXrciUWR/E4HsRZTnknZ5m3zt+BDI4ol kM2d6P6J6wPdheZnME7eLM7R2PEyscVOW62LnXDquBbqRiuifk8DaD9zPXpUcOPepN3O lGKFx8iLnBVXJEtdRksaQo4YHBNfcChn7Oh9BGyAS4ZIYtS984SJvWd4Ump0zQ4qGoxq izMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=dwbtyS06YkW0qRsH94vEFI4tkESpQd2SvHtOqpt4cB0=; b=3AzVj4mkTVgyqSrTXU3IA8Mx8ct3j2k8iVvmC4VfW1fwKybkhSokclfELW5xyq/h++ WzqEHR1Hx8We6TRHfi9JUIjAUtGGAUFsgvvtOZ7cq/mHs+wWJLVKQmtMkU5ItXwN8rzg 5SRyvsPf7VpCv2k++dEm9oslF01d5VJOZQPRxRhVOi76ZUR+iaxVa7moIs6oM9V/is/C Ytzo+GrApCkysw7L+0a2/3x5y8j4H8tEBDNCUZ8+GifJOpA+0Zv1SeACv2qTyzJrrAOI 1wayUTNqAUMAHoZH6QeD661nPeTZlEx6DVsxrOVP8fYHg5xNugT3xl3yCIfFMSzsX+00 ENxw== X-Gm-Message-State: AOAM532ICwky4hPxt2Vg4NcO0s+6Z63yb8IzGweKqznEQxLnooQ+xVIp C/LrP/BwMxft3pUoAHQxUUHOx4pYFlI= X-Google-Smtp-Source: ABdhPJy3wodZU4WeOG5tibkHywvOzGsYkKpnC+Sq5aSklIiQ5gQfEQh72XXACEXFjBDcAN102xbWgg== X-Received: by 2002:a05:620a:4087:: with SMTP id f7mr6979852qko.639.1639535745951; Tue, 14 Dec 2021 18:35:45 -0800 (PST) Received: from nuc ([142.126.186.191]) by smtp.gmail.com with ESMTPSA id j12sm627377qta.54.2021.12.14.18.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 18:35:45 -0800 (PST) Sender: Mark Johnston Date: Tue, 14 Dec 2021 21:35:42 -0500 From: Mark Johnston To: Kristof Provost Cc: Gleb Smirnoff , 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 Message-ID: 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <28AE53F1-2B22-444B-B1EC-1600FA741FE2@FreeBSD.org> X-Rspamd-Queue-Id: 4JDK9Z6KQmz4ZXb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N 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=eb93b99d698674e3b1cc7139fda98e2b175b8c5b > > > > 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’s as if > `crfree(inp->inp_cred);` doesn’t actually get called. And indeed, 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. 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. > > Does > > > Kristof