From nobody Mon May 29 22:11:21 2023 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 4QVV9Q1G7Lz4XFfq; Mon, 29 May 2023 22:11:22 +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 4QVV9P5mJkz3KH2; Mon, 29 May 2023 22:11:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685398281; 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=73y9Wrn9ef86kq1nli66g4xM75Kieilm0EfWY6JuvFc=; b=BQiq9LZ/njChmC2OzxjSudQ0F43Kn5PEE4Hr7+l58hHzco/nwFBUIFT6Hl0m0S3Tbwz2Od HIKtvDRDMrYZEaPs0+GF+YOO18ZCs5C9UfOkIHZbgJ0cCI8xvmYo25YBRX/12JG17n+Shy wl79sn3XIAxCBsH3dfg7yZU/r+0JrP/a+oo+tPSw7PqRQqjBx6gdtO3eytPsUdwaloUQxP pngGprKW9rHv9TRgrVsF5riMF1Q0+44o5kaEefv1kPXq/5QsaXtlLpCeF09DOC5cHZbMpa 2IDqk0/Uixz+2Ls98nYh5IhvIVfFlcsJrHTA7LyR/ZwhRuseuLoOmYDDmNsxAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685398281; 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=73y9Wrn9ef86kq1nli66g4xM75Kieilm0EfWY6JuvFc=; b=YDeMv2pc5SYQ7ZW8BWLcLiPE9MJbjp9ltu6/VAt2JF1f70dTiXcSg//bsguRxbBWcd7YNZ BOXToUF4/x5dbxHAAFogRu6LVRZ33T0BpGrAwfRSN95kEkpV5ZRg/uFxLB5FP5t70akD5t Y1f1wkRmEQmZdvYgul7147BG2np+OUhMgksRXFP41Ub33IaKZM2mAoggUd/qhAZVcU+OFm ljZ46iY60ICskFTN/RvLbwRShqlzgIVeOql54oOV2HA/F693zjDFmf6fdAaPqFEecqXrpQ S7aPMwKnWxDBoYD0hjr/lRZcOD3Revj4fEgN2hTyNQirw7eqC0pqvq/8lsl9bA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685398281; a=rsa-sha256; cv=none; b=mscFIa35UhNqX9ik85uWdtf8pA+yvTmVFT8IZ16A8jixh720bFLxnNxGfee0DqndpmgGwA YD17GypHR5p5mDJ6embj4050qK5bzNKnediTjXWtBaIRrVtYdmp2bOGeVuJpgxZQ1//z24 2G5qXvbQcVQSFdHaCTv1/kqezrnMSlFsTyY2tyURNFycUWVh9aXLzzqFGPC0M4vwMYCTVG hYC/FbvY6ngeUVz59/EefHySZqICHUeaOcK+NXiLRo3GtOz6DGtGbf2uSrJZgbuabfuX6s Q4rTyPipPzt/4butaaxKENlyFg+Lab25SipU7I3Uk/Ba8hcpoxBnVXnAnxlfXA== 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 4QVV9P4tHkzSxG; Mon, 29 May 2023 22:11:21 +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 34TMBLPV044497; Mon, 29 May 2023 22:11:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34TMBLPh044496; Mon, 29 May 2023 22:11:21 GMT (envelope-from git) Date: Mon, 29 May 2023 22:11:21 GMT Message-Id: <202305292211.34TMBLPh044496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f8c37080853c - main - unr(9): document clean_unrhdr() 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: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8c37080853c13ada935e7fe3d53286c1d9220f1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f8c37080853c13ada935e7fe3d53286c1d9220f1 commit f8c37080853c13ada935e7fe3d53286c1d9220f1 Author: Konstantin Belousov AuthorDate: 2023-05-14 00:43:54 +0000 Commit: Konstantin Belousov CommitDate: 2023-05-29 22:10:36 +0000 unr(9): document clean_unrhdr() Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D40089 --- 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.