Index: sys/amd64/amd64/pmap.c =================================================================== --- sys/amd64/amd64/pmap.c +++ sys/amd64/amd64/pmap.c @@ -5085,7 +5085,7 @@ #define PC_FREE0 0xfffffffffffffffful #define PC_FREE1 0xfffffffffffffffful -#define PC_FREE2 0x000000fffffffffful +#define PC_FREE2 ((1ul << (_NPCPV % 64)) - 1) static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1, PC_FREE2 }; Index: sys/amd64/include/pmap.h =================================================================== --- sys/amd64/include/pmap.h +++ sys/amd64/include/pmap.h @@ -439,8 +439,9 @@ * pv_entries are allocated in chunks per-process. This avoids the * need to track per-pmap assignments. */ -#define _NPCM 3 #define _NPCPV 168 +#define _NPCM howmany(_NPCPV, 64) + #define PV_CHUNK_HEADER \ pmap_t pc_pmap; \ TAILQ_ENTRY(pv_chunk) pc_list; \ Index: sys/arm/arm/pmap-v6.c =================================================================== --- sys/arm/arm/pmap-v6.c +++ sys/arm/arm/pmap-v6.c @@ -2753,7 +2753,7 @@ #define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap) #define PC_FREE0_9 0xfffffffful /* Free values for index 0 through 9 */ -#define PC_FREE10 0x0000fffful /* Free values for index 10 */ +#define PC_FREE10 ((1ul << (_NPCPV % 32)) - 1) /* Free values for index 10 */ static const uint32_t pc_freemask[_NPCM] = { PC_FREE0_9, PC_FREE0_9, PC_FREE0_9, Index: sys/arm/include/pmap-v6.h =================================================================== --- sys/arm/include/pmap-v6.h +++ sys/arm/include/pmap-v6.h @@ -143,8 +143,9 @@ * pv_entries are allocated in chunks per-process. This avoids the * need to track per-pmap assignments. */ -#define _NPCM 11 #define _NPCPV 336 +#define _NPCM howmany(_NPCPV, 32) + struct pv_chunk { pmap_t pc_pmap; TAILQ_ENTRY(pv_chunk) pc_list; Index: sys/i386/i386/pmap.c =================================================================== --- sys/i386/i386/pmap.c +++ sys/i386/i386/pmap.c @@ -2301,7 +2301,7 @@ #define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap) #define PC_FREE0_9 0xfffffffful /* Free values for index 0 through 9 */ -#define PC_FREE10 0x0000fffful /* Free values for index 10 */ +#define PC_FREE10 ((1ul << (_NPCPV % 32)) - 1) /* Free values for index 10 */ static const uint32_t pc_freemask[_NPCM] = { PC_FREE0_9, PC_FREE0_9, PC_FREE0_9, Index: sys/i386/include/pmap.h =================================================================== --- sys/i386/include/pmap.h +++ sys/i386/include/pmap.h @@ -209,8 +209,9 @@ * pv_entries are allocated in chunks per-process. This avoids the * need to track per-pmap assignments. */ -#define _NPCM 11 #define _NPCPV 336 +#define _NPCM howmany(_NPCPV, 32) + struct pv_chunk { pmap_t pc_pmap; TAILQ_ENTRY(pv_chunk) pc_list; Index: sys/powerpc/aim/mmu_radix.c =================================================================== --- sys/powerpc/aim/mmu_radix.c +++ sys/powerpc/aim/mmu_radix.c @@ -1169,7 +1169,7 @@ #define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap) #define PC_FREE0 0xfffffffffffffffful -#define PC_FREE1 0x3ffffffffffffffful +#define PC_FREE1 ((1ul << (_NPCPV % 64)) - 1) static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1 }; Index: sys/powerpc/include/pmap.h =================================================================== --- sys/powerpc/include/pmap.h +++ sys/powerpc/include/pmap.h @@ -214,8 +214,9 @@ * pv_entries are allocated in chunks per-process. This avoids the * need to track per-pmap assignments. */ -#define _NPCM 2 #define _NPCPV 126 +#define _NPCM howmany(_NPCPV, 64) + #define PV_CHUNK_HEADER \ pmap_t pc_pmap; \ TAILQ_ENTRY(pv_chunk) pc_list; \ Index: sys/riscv/include/pmap.h =================================================================== --- sys/riscv/include/pmap.h +++ sys/riscv/include/pmap.h @@ -97,8 +97,9 @@ * pv_entries are allocated in chunks per-process. This avoids the * need to track per-pmap assignments. */ -#define _NPCM 3 #define _NPCPV 168 +#define _NPCM howmany(_NPCPV, 64) + struct pv_chunk { struct pmap * pc_pmap; TAILQ_ENTRY(pv_chunk) pc_list; Index: sys/riscv/riscv/pmap.c =================================================================== --- sys/riscv/riscv/pmap.c +++ sys/riscv/riscv/pmap.c @@ -1727,7 +1727,7 @@ #define PC_FREE0 0xfffffffffffffffful #define PC_FREE1 0xfffffffffffffffful -#define PC_FREE2 0x000000fffffffffful +#define PC_FREE2 ((1ul << (_NPCPV % 64)) - 1) static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1, PC_FREE2 };