diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index 5908c6df0696..bc7b2ae3f7e9 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -106,7 +106,8 @@ static struct rwlock_padalign vm_phys_fictitious_reg_lock; MALLOC_DEFINE(M_FICT_PAGES, "vm_fictitious", "Fictitious VM pages"); static struct vm_freelist __aligned(CACHE_LINE_SIZE) - vm_phys_free_queues[MAXMEMDOM][VM_NFREELIST][VM_NFREEPOOL][VM_NFREEORDER]; + vm_phys_free_queues[MAXMEMDOM][VM_NFREELIST][VM_NFREEPOOL] + [VM_NFREEORDER_MAX]; static int __read_mostly vm_nfreelists; diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h index 08c1a92d25f8..b8d3657c2f16 100644 --- a/sys/vm/vm_phys.h +++ b/sys/vm/vm_phys.h @@ -42,6 +42,10 @@ #ifdef _KERNEL +#ifndef VM_NFREEORDER_MAX +#define VM_NFREEORDER_MAX VM_NFREEORDER +#endif + /* Domains must be dense (non-sparse) and zero-based. */ struct mem_affinity { vm_paddr_t start; @@ -63,7 +67,7 @@ struct vm_phys_seg { vm_paddr_t end; vm_page_t first_page; int domain; - struct vm_freelist (*free_queues)[VM_NFREEPOOL][VM_NFREEORDER]; + struct vm_freelist (*free_queues)[VM_NFREEPOOL][VM_NFREEORDER_MAX]; }; extern struct vm_phys_seg vm_phys_segs[]; diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index 0cfc69f57e21..49ee4ca1f9e8 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -77,10 +77,15 @@ __FBSDID("$FreeBSD$"); #if VM_NRESERVLEVEL > 0 +#ifndef VM_LEVEL_0_ORDER_MAX +#define VM_LEVEL_0_ORDER_MAX VM_LEVEL_0_ORDER +#endif + /* * The number of small pages that are contained in a level 0 reservation */ #define VM_LEVEL_0_NPAGES (1 << VM_LEVEL_0_ORDER) +#define VM_LEVEL_0_NPAGES_MAX (1 << VM_LEVEL_0_ORDER_MAX) /* * The number of bits by which a physical address is shifted to obtain the @@ -114,6 +119,7 @@ typedef u_long popmap_t; * The number of population map entries in a reservation */ #define NPOPMAP howmany(VM_LEVEL_0_NPAGES, NBPOPMAP) +#define NPOPMAP_MAX howmany(VM_LEVEL_0_NPAGES_MAX, NBPOPMAP) /* * Number of elapsed ticks before we update the LRU queue position. Used @@ -191,7 +197,7 @@ struct vm_reserv { uint16_t popcnt; /* (r) # of pages in use */ int lasttick; /* (r) last pop update tick. */ char inpartpopq; /* (d) */ - popmap_t popmap[NPOPMAP]; /* (r) bit vector, used pages */ + popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ }; #define vm_reserv_lockptr(rv) (&(rv)->lock)