svn commit: r343145 - head/sys/vm
Konstantin Belousov
kib at FreeBSD.org
Fri Jan 18 13:35:08 UTC 2019
Author: kib
Date: Fri Jan 18 13:35:06 2019
New Revision: 343145
URL: https://svnweb.freebsd.org/changeset/base/343145
Log:
MI VM: Make it possible to set size of superpage at boot instead of compile time.
In order to allow single kernel to use PAE pagetables on i386 if
hardware supports it, and fall back to classic two-level paging
structures if not, superpage code should be able to adopt to either 2M
or 4M superpages size. There I make MI VM structures large enough to
track the biggest possible superpage, by allowing architecture to
define VM_NFREEORDER_MAX and VM_LEVEL_0_ORDER_MAX constants.
Corresponding VM_NFREEORDER and VM_LEVEL_0_ORDER symbols can be
defined as runtime values and must be less than the _MAX constants.
If architecture does not define _MAXs, it is assumed that _MAX ==
normal constant.
Reviewed by: markj
Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18853
Modified:
head/sys/vm/vm_phys.c
head/sys/vm/vm_phys.h
head/sys/vm/vm_reserv.c
Modified: head/sys/vm/vm_phys.c
==============================================================================
--- head/sys/vm/vm_phys.c Fri Jan 18 10:54:36 2019 (r343144)
+++ head/sys/vm/vm_phys.c Fri Jan 18 13:35:06 2019 (r343145)
@@ -106,7 +106,8 @@ static struct rwlock_padalign vm_phys_fictitious_reg_l
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;
Modified: head/sys/vm/vm_phys.h
==============================================================================
--- head/sys/vm/vm_phys.h Fri Jan 18 10:54:36 2019 (r343144)
+++ head/sys/vm/vm_phys.h Fri Jan 18 13:35:06 2019 (r343145)
@@ -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[];
Modified: head/sys/vm/vm_reserv.c
==============================================================================
--- head/sys/vm/vm_reserv.c Fri Jan 18 10:54:36 2019 (r343144)
+++ head/sys/vm/vm_reserv.c Fri Jan 18 13:35:06 2019 (r343145)
@@ -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)
More information about the svn-src-all
mailing list