diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 893774357629..326103a1affb 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -5085,7 +5085,7 @@ pv_to_chunk(pv_entry_t pv) #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 }; diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 3d51803d82b7..c37ae82c0301 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -439,8 +439,9 @@ typedef struct pv_entry { * 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; \ diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index 51438274f1ff..107519be9dc0 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -2753,7 +2753,7 @@ pv_to_chunk(pv_entry_t pv) #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, diff --git a/sys/arm/include/pmap-v6.h b/sys/arm/include/pmap-v6.h index aa596aa699c6..adb21fbb82fa 100644 --- a/sys/arm/include/pmap-v6.h +++ b/sys/arm/include/pmap-v6.h @@ -143,8 +143,9 @@ typedef struct pv_entry { * 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; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index eaff33bafe84..70139b2f4e66 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2301,7 +2301,7 @@ pv_to_chunk(pv_entry_t pv) #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, diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h index 5ac99b92cad3..7174c3d5b2bd 100644 --- a/sys/i386/include/pmap.h +++ b/sys/i386/include/pmap.h @@ -209,8 +209,9 @@ typedef struct pv_entry { * 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; diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 955618d57e68..82d411db851a 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -1169,7 +1169,7 @@ pv_to_chunk(pv_entry_t pv) #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 }; diff --git a/sys/powerpc/include/pmap.h b/sys/powerpc/include/pmap.h index d14398750080..1240b5fe5c7e 100644 --- a/sys/powerpc/include/pmap.h +++ b/sys/powerpc/include/pmap.h @@ -214,8 +214,9 @@ struct pmap { * 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; \ diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h index 8eb5b394fd32..6bfede99e578 100644 --- a/sys/riscv/include/pmap.h +++ b/sys/riscv/include/pmap.h @@ -97,8 +97,9 @@ typedef struct pv_entry { * 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; diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 9799b2b7bd91..3ac6f9997978 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1727,7 +1727,7 @@ pv_to_chunk(pv_entry_t pv) #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 };