From nobody Mon Jun 5 08:36:04 2023 X-Original-To: dev-commits-src-branches@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 4QZRlT23L1z4bLsL; Mon, 5 Jun 2023 08:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QZRlT1LbSz3xFH; Mon, 5 Jun 2023 08:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685954165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mi/6Ie06cI10EG9aIgeLK5I4TZNsLVgPgfZG245Ptow=; b=QlJD6z52uYE8REM5ZAd3uFYkbUc0n64rnMD2badjK4C0ckgwGp/FjTomHrnnAUrMUYpOxd lpGE0B2Rj1GJNtE64ZVY4Som/YxkON9DMn/ctguCgYjiGVCW5Sohi8aDz8f2nevN/DDtFD spRACOa1D8+ZWfzTU1bWTzWtMslR0pT17ZynQme7FnCLx5/3p7firaRqA2r61uVfKGKp4/ 4jhw/tUsDRPzVSfD0mSNo+MPrUba1iX47ll6G5rtMMdimJgAbodLLqEmVqwsRSA46A2KWw C7xUEF0YfqsokPkZC79akb6VsOo4E6iwjSTszXa4rR9mDlrGTY1QwRcnSoGkIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685954165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mi/6Ie06cI10EG9aIgeLK5I4TZNsLVgPgfZG245Ptow=; b=K8zFWyvc6GTaZOUcDz6ugxmx2z25eUjikZGLX2cQ9Lic0VI5zDjOBf83cq1WUwRnaTRydx B6XBKTq5FoLGejusu991NP3zhXCW/z/c6YoaUQFdm89d63MdGLdRiZXa20rlp5ZQdxJmM/ htiGupTAMgPKHRztx4bZMVH06g1NhZfUB0K29Hff4KR26uRBJD5yNfDbwhHoHnwVhf8v3d c5M4qA/FPs6ES7R8x6LinFYhGlxghsN0Lf4EbWAK/pvNsaa5jVdS121HYqFiDzK0wt0rTw TxErM1Qq61PmbHeJ5erBbZDxwL5wS9KjUdcrRc9sQdWbKtrHOnxYuLG1bvqGqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685954165; a=rsa-sha256; cv=none; b=bTdO9Tt3EoQICwuBJge68Uhfqur6GE+2dg8olDVxaKl3GLx9foaXnnX2+txFWWihDBMTwo lpWxF8EAIjhoEywxJPYhlGl9Fanhc54i17scVQnuuG2VNBmIt5JfEeDjiWh3XRV5Omj2hg cz7MpSjnEKPmoqTzKnoEQuvGq5fK6LpHBD3JGQlh32+Kaz1JSF6J63oQGy4zRamOkcBc3q h6XgngENn4lRVhbudDYDkOK0LwJ6F6QqJz+mp9pFw5X02Ynht2ggmBliloCcyZg70QjqAp aCDVavmXRTjxPS+09g9FBXDKESJv9EhsZEcB/HU8rpFzP1kYlgT+BsnP4Z4+Ww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QZRlT0NRvzgPs; Mon, 5 Jun 2023 08:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 3558a4Sa024411; Mon, 5 Jun 2023 08:36:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3558a48v024410; Mon, 5 Jun 2023 08:36:04 GMT (envelope-from git) Date: Mon, 5 Jun 2023 08:36:04 GMT Message-Id: <202306050836.3558a48v024410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4ae4e074ebe8 - stable/13 - unr(9): document clean_unrhdr() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4ae4e074ebe8d1ffa749ae7444b1704acc2b25d2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4ae4e074ebe8d1ffa749ae7444b1704acc2b25d2 commit 4ae4e074ebe8d1ffa749ae7444b1704acc2b25d2 Author: Konstantin Belousov AuthorDate: 2023-05-14 00:43:54 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-05 08:35:01 +0000 unr(9): document clean_unrhdr() (cherry picked from commit f8c37080853c13ada935e7fe3d53286c1d9220f1) --- share/man/man9/unr.9 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/share/man/man9/unr.9 b/share/man/man9/unr.9 index c2e9b3943829..c0cf44b9033e 100644 --- a/share/man/man9/unr.9 +++ b/share/man/man9/unr.9 @@ -29,6 +29,7 @@ .Os .Sh NAME .Nm new_unrhdr , +.Nm clean_unrhdr , .Nm clear_unrhdr , .Nm delete_unrhdr , .Nm alloc_unr , @@ -40,6 +41,10 @@ .Ft "struct unrhdr *" .Fn new_unrhdr "int low" "int high" "struct mtx *mutex" .Ft void +.Fn clean_unrhdr "struct unrhdr *uh" +.Ft void +.Fn clean_unrhdrl "struct unrhdr *uh" +.Ft void .Fn clear_unrhdr "struct unrhdr *uh" .Ft void .Fn delete_unrhdr "struct unrhdr *uh" @@ -86,6 +91,26 @@ This function frees the memory associated with the entity, it does not free any units. To free all units use .Fn clear_unrhdr . +.It Fn clean_unrhdr uh +Freeing unit numbers might result in some internal memory becoming unused. +There are +.Nm unit +allocator consumers that cannot tolerate taking +.Xr malloc 9 +locks to free the memory, while having their unit mutex locked. +For this reason, free of the unused memory after delete is postponed +until the consumer can afford calling into the +.Xr malloc 9 +subsystem. +Call +.Fn clean_unrhdr uh +to do the cleanup. +In particular, this needs to be done before freeing a unr, if +a deletion of units could have been performed. +.It Fn clean_unrhdrl +Same as +.Fn clean_unrhdr , +but assumes that the unr mutex is already owned, if any. .It Fn alloc_unr uh Return a new unit number. The lowest free number is always allocated.