git: d44f477038d3 - main - subr_unit.c: explain first/last special ranges

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 29 May 2023 22:11:20 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=d44f477038d3ede5fe62fa19c9301b43455cd8f1

commit d44f477038d3ede5fe62fa19c9301b43455cd8f1
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-05-14 23:11:17 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-05-29 22:10:35 +0000

    subr_unit.c: explain first/last special ranges
    
    Reviewed by:    markj
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D40089
---
 sys/kern/subr_unit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c
index a1878ea4b144..b0977c3c01b9 100644
--- a/sys/kern/subr_unit.c
+++ b/sys/kern/subr_unit.c
@@ -178,6 +178,12 @@ mtx_assert(struct mtx *mp, int flag)
  * For bitmaps the len field represents the number of allocated items.
  *
  * The bitmap is the same size as struct unr to optimize memory management.
+ *
+ * Two special ranges are not covered by unrs:
+ * - at the start of the allocator space, all elements in [low, low + first)
+ *   are allocated;
+ * - at the end of the allocator space, all elements in [high - last, high]
+ *   are free.
  */
 struct unr {
 	TAILQ_ENTRY(unr)	list;