Date: Mon, 21 Sep 2020 22:19:12 +0000 (UTC) From: D Scott Phillips <scottph@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365975 - in head: share/man/man9 sys/sys Message-ID: <202009212219.08LMJCm5052904@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: scottph Date: Mon Sep 21 22:19:12 2020 New Revision: 365975 URL: https://svnweb.freebsd.org/changeset/base/365975 Log: bitset: expand bit index type to `long` An upcoming patch to use the bitset macros for tracking vm page dump information could conceivably need more than INT_MAX bits. Expand the bit type to long so that the extra range is available on 64-bit platforms where it would most likely be needed. CPUSET_COUNT and DOMAINSET_COUNT are also modified to remain of type `int`. Reviewed by: kib, markj Approved by: scottl (implicit) MFC after: 1 week Sponsored by: Ampere Computing, Inc. Differential Revision: https://reviews.freebsd.org/D26190 Modified: head/share/man/man9/bitset.9 head/sys/sys/bitset.h head/sys/sys/cpuset.h head/sys/sys/domainset.h Modified: head/share/man/man9/bitset.9 ============================================================================== --- head/share/man/man9/bitset.9 Mon Sep 21 22:18:09 2020 (r365974) +++ head/share/man/man9/bitset.9 Mon Sep 21 22:19:12 2020 (r365975) @@ -84,13 +84,13 @@ .Fn BIT_EMPTY "const SETSIZE" "struct STRUCTNAME *bitset" .Ft bool .Fn BIT_ISFULLSET "const SETSIZE" "struct STRUCTNAME *bitset" -.Ft int +.Ft long .Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset" -.Ft int -.Fn BIT_FFS_AT "const SETSIZE" "struct STRUCTNAME *bitset" "int start" -.Ft int +.Ft long +.Fn BIT_FFS_AT "const SETSIZE" "struct STRUCTNAME *bitset" "long start" +.Ft long .Fn BIT_FLS "const SETSIZE" "struct STRUCTNAME *bitset" -.Ft int +.Ft long .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset" .\" .Ft bool Modified: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Mon Sep 21 22:18:09 2020 (r365974) +++ head/sys/sys/bitset.h Mon Sep 21 22:19:12 2020 (r365975) @@ -213,8 +213,7 @@ */ #define BIT_FFS_AT(_s, p, start) __extension__ ({ \ __size_t __i; \ - long __mask; \ - int __bit; \ + long __bit, __mask; \ \ __mask = ~0UL << ((start) % _BITSET_BITS); \ __bit = 0; \ @@ -235,7 +234,7 @@ #define BIT_FLS(_s, p) __extension__ ({ \ __size_t __i; \ - int __bit; \ + long __bit; \ \ __bit = 0; \ for (__i = __bitset_words((_s)); __i > 0; __i--) { \ @@ -250,7 +249,7 @@ #define BIT_COUNT(_s, p) __extension__ ({ \ __size_t __i; \ - int __count; \ + long __count; \ \ __count = 0; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ Modified: head/sys/sys/cpuset.h ============================================================================== --- head/sys/sys/cpuset.h Mon Sep 21 22:18:09 2020 (r365974) +++ head/sys/sys/cpuset.h Mon Sep 21 22:19:12 2020 (r365975) @@ -65,7 +65,7 @@ #define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) -#define CPU_COUNT(p) BIT_COUNT(CPU_SETSIZE, p) +#define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER Modified: head/sys/sys/domainset.h ============================================================================== --- head/sys/sys/domainset.h Mon Sep 21 22:18:09 2020 (r365974) +++ head/sys/sys/domainset.h Mon Sep 21 22:19:12 2020 (r365975) @@ -68,7 +68,7 @@ BIT_COPY_STORE_REL(DOMAINSET_SETSIZE, f, t) #define DOMAINSET_FFS(p) BIT_FFS(DOMAINSET_SETSIZE, p) #define DOMAINSET_FLS(p) BIT_FLS(DOMAINSET_SETSIZE, p) -#define DOMAINSET_COUNT(p) BIT_COUNT(DOMAINSET_SETSIZE, p) +#define DOMAINSET_COUNT(p) ((int)BIT_COUNT(DOMAINSET_SETSIZE, p)) #define DOMAINSET_FSET BITSET_FSET(_NDOMAINSETWORDS) #define DOMAINSET_T_INITIALIZER BITSET_T_INITIALIZER
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009212219.08LMJCm5052904>