summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2008-09-25 07:03:09 +0000
committerkmacy <kmacy@FreeBSD.org>2008-09-25 07:03:09 +0000
commit562209dc2488ea36065e127e3ebb0c612f991cc9 (patch)
treedc5694f8451ed002089cbb4d9ca4027d7e93491b
parent7db949181aa616d69138177476e4c049548d3403 (diff)
downloadFreeBSD-src-562209dc2488ea36065e127e3ebb0c612f991cc9.zip
FreeBSD-src-562209dc2488ea36065e127e3ebb0c612f991cc9.tar.gz
Make nkpt dependent on the size of the initial memory allocation
MFC after: 1 month
-rw-r--r--sys/i386/xen/pmap.c3
-rw-r--r--sys/i386/xen/xen_machdep.c16
2 files changed, 9 insertions, 10 deletions
diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c
index a9b37c3..d646458 100644
--- a/sys/i386/xen/pmap.c
+++ b/sys/i386/xen/pmap.c
@@ -437,7 +437,8 @@ pmap_bootstrap(vm_paddr_t firstaddr)
mtx_lock_spin(&allpmaps_lock);
LIST_INSERT_HEAD(&allpmaps, kernel_pmap, pm_list);
mtx_unlock_spin(&allpmaps_lock);
- nkpt = NKPT;
+ if (nkpt == 0)
+ nkpt = NKPT;
/*
* Reserve some special page table entries/VA space for temporary
diff --git a/sys/i386/xen/xen_machdep.c b/sys/i386/xen/xen_machdep.c
index 4c486a1..e49b137 100644
--- a/sys/i386/xen/xen_machdep.c
+++ b/sys/i386/xen/xen_machdep.c
@@ -557,8 +557,7 @@ xen_create_contiguous_region(vm_page_t pages, int npages)
.extent_order = 0,
.domid = DOMID_SELF
};
- set_xen_guest_handle(reservation.extent_start, &mfn);
-
+ reservation.extent_start = &mfn;
balloon_lock(flags);
@@ -634,7 +633,7 @@ xen_destroy_contiguous_region(void *addr, int npages)
.extent_order = 0,
.domid = DOMID_SELF
};
- set_xen_guest_handle(reservation.extent_start, &mfn);
+ reservation.extent_start = &mfn;
pfn0 = vtophys(addr) >> PAGE_SHIFT;
#if 0
@@ -805,7 +804,7 @@ shift_phys_machine(unsigned long *phys_machine, int nr_pages)
extern unsigned long physfree;
int pdir, curoffset;
-
+extern int nkpt;
void
initvalues(start_info_t *startinfo)
@@ -828,15 +827,14 @@ initvalues(start_info_t *startinfo)
unsigned long i;
int ncpus;
+ nkpt = min(max((startinfo->nr_pages >> NPGPTD_SHIFT), nkpt),
+ NPGPTD*NPDEPG - KPTDI);
#ifdef SMP
ncpus = MAXCPU;
#else
ncpus = 1;
#endif
-#if 0
- HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
-#endif
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
#ifdef notyet
/*
@@ -961,8 +959,8 @@ initvalues(start_info_t *startinfo)
xen_load_cr3(VTOP(IdlePDPTnew));
xen_pgdpt_pin(xpmap_ptom(VTOP(IdlePDPTnew)));
- /* allocate remainder of NKPT pages */
- for (offset = (KERNBASE >> PDRSHIFT), i = l1_pages - 1; i < NKPT;
+ /* allocate remainder of nkpt pages */
+ for (offset = (KERNBASE >> PDRSHIFT), i = l1_pages - 1; i < nkpt;
i++, cur_space += PAGE_SIZE) {
pdir = (offset + i) / NPDEPG;
curoffset = ((offset + i) % NPDEPG);
OpenPOWER on IntegriCloud