[newlib 02/22] Use a precise bit count for the slab free items in UMA.

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jun 22 08:24:25 UTC 2022


From: Jeff Roberson <jeff at FreeBSD.org>

This significantly shrinks embedded slab structures.

Reviewed by:	markj, rlibby (prior version)
Differential Revision:	https://reviews.freebsd.org/D22584
---
 newlib/libc/sys/rtems/include/sys/bitset.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/bitset.h b/newlib/libc/sys/rtems/include/sys/bitset.h
index cd70fd4f0..d119c23ca 100644
--- a/newlib/libc/sys/rtems/include/sys/bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/bitset.h
@@ -249,10 +249,11 @@
 #define	BITSET_FSET(n)							\
 	[ 0 ... ((n) - 1) ] = (-1L)
 
+#define	BITSET_SIZE(_s)	(__bitset_words((_s)) * sizeof(long))
+
 /*
  * Dynamically allocate a bitset.
  */
-#define BITSET_ALLOC(_s, mt, mf)					\
-	malloc(__bitset_words(_s) * sizeof(long), mt, (mf))
+#define BITSET_ALLOC(_s, mt, mf)	malloc(BITSET_SIZE((_s)), mt, (mf))
 
 #endif /* !_SYS_BITSET_H_ */
-- 
2.35.3



More information about the devel mailing list