git: 205043060940 - stable/14 - libthr: switch thread and sleepq memory allocator to crt from libc malloc

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 21 Jan 2025 00:26:41 UTC
The branch stable/14 has been updated by kib:

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

commit 2050430609400237e4120e099c1aabd4e77e1c1e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-01-14 09:06:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-01-21 00:24:55 +0000

    libthr: switch thread and sleepq memory allocator to crt from libc malloc
    
    (cherry picked from commit 9a2ae72421cd75c741984f63b8c9ee89346a188d)
---
 lib/libthr/thread/thr_list.c   | 4 ++--
 lib/libthr/thread/thr_sleepq.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libthr/thread/thr_list.c b/lib/libthr/thread/thr_list.c
index d13cead7e588..6b41951aaf59 100644
--- a/lib/libthr/thread/thr_list.c
+++ b/lib/libthr/thread/thr_list.c
@@ -151,7 +151,7 @@ _thr_alloc(struct pthread *curthread)
 		if (total_threads > MAX_THREADS)
 			return (NULL);
 		atomic_add_int(&total_threads, 1);
-		thread = calloc(1, sizeof(struct pthread));
+		thread = __thr_calloc(1, sizeof(struct pthread));
 		if (thread == NULL) {
 			atomic_add_int(&total_threads, -1);
 			return (NULL);
@@ -223,7 +223,7 @@ thr_destroy(struct pthread *curthread __unused, struct pthread *thread)
 		_sleepq_free(thread->sleepqueue);
 	if (thread->wake_addr != NULL)
 		_thr_release_wake_addr(thread->wake_addr);
-	free(thread);
+	__thr_free(thread);
 }
 
 /*
diff --git a/lib/libthr/thread/thr_sleepq.c b/lib/libthr/thread/thr_sleepq.c
index d7de9ab4e25a..9c680acd0ac0 100644
--- a/lib/libthr/thread/thr_sleepq.c
+++ b/lib/libthr/thread/thr_sleepq.c
@@ -62,7 +62,7 @@ _sleepq_alloc(void)
 {
 	struct sleepqueue *sq;
 
-	sq = calloc(1, sizeof(struct sleepqueue));
+	sq = __thr_calloc(1, sizeof(struct sleepqueue));
 	TAILQ_INIT(&sq->sq_blocked);
 	SLIST_INIT(&sq->sq_freeq);
 	return (sq);
@@ -71,7 +71,7 @@ _sleepq_alloc(void)
 void
 _sleepq_free(struct sleepqueue *sq)
 {
-	free(sq);
+	__thr_free(sq);
 }
 
 void