svn commit: r347616 - in stable/11/sys: amd64/amd64 i386/i386
Mark Johnston
markj at FreeBSD.org
Wed May 15 15:49:31 UTC 2019
Author: markj
Date: Wed May 15 15:49:29 2019
New Revision: 347616
URL: https://svnweb.freebsd.org/changeset/base/347616
Log:
MFC r339046, r339073:
Count bootstrap data as resident in the kernel pmap.
Modified:
stable/11/sys/amd64/amd64/pmap.c
stable/11/sys/i386/i386/pmap.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/11/sys/amd64/amd64/pmap.c Wed May 15 15:11:49 2019 (r347615)
+++ stable/11/sys/amd64/amd64/pmap.c Wed May 15 15:49:29 2019 (r347616)
@@ -1016,9 +1016,11 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
{
vm_offset_t va;
pt_entry_t *pte;
+ u_long res;
int i;
KERNend = *firstaddr;
+ res = atop(KERNend - (vm_paddr_t)kernphys);
if (!pti)
pg_g = X86_PG_G;
@@ -1038,10 +1040,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
vm_phys_add_seg(KPTphys, KPTphys + ptoa(nkpt));
virtual_avail = (vm_offset_t) KERNBASE + *firstaddr;
-
virtual_end = VM_MAX_KERNEL_ADDRESS;
-
/* XXX do %cr0 as well */
load_cr4(rcr4() | CR4_PGE);
load_cr3(KPML4phys);
@@ -1050,6 +1050,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
/*
* Initialize the kernel pmap (which is statically allocated).
+ * Count bootstrap data as being resident in case any of this data is
+ * later unmapped (using pmap_remove()) and freed.
*/
PMAP_LOCK_INIT(kernel_pmap);
kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys);
@@ -1057,6 +1059,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
kernel_pmap->pm_ucr3 = PMAP_NO_CR3;
CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */
TAILQ_INIT(&kernel_pmap->pm_pvchunk);
+ kernel_pmap->pm_stats.resident_count = res;
kernel_pmap->pm_flags = pmap_flags;
/*
Modified: stable/11/sys/i386/i386/pmap.c
==============================================================================
--- stable/11/sys/i386/i386/pmap.c Wed May 15 15:11:49 2019 (r347615)
+++ stable/11/sys/i386/i386/pmap.c Wed May 15 15:49:29 2019 (r347616)
@@ -377,8 +377,11 @@ pmap_bootstrap(vm_paddr_t firstaddr)
vm_offset_t va;
pt_entry_t *pte, *unused;
struct pcpu *pc;
+ u_long res;
int i;
+ res = atop(firstaddr - (vm_paddr_t)KERNLOAD);
+
/*
* Add a physical memory segment (vm_phys_seg) corresponding to the
* preallocated kernel page table pages so that vm_page structures
@@ -396,11 +399,12 @@ pmap_bootstrap(vm_paddr_t firstaddr)
* unused virtual address in addition to "firstaddr".
*/
virtual_avail = (vm_offset_t) KERNBASE + firstaddr;
-
virtual_end = VM_MAX_KERNEL_ADDRESS;
/*
* Initialize the kernel pmap (which is statically allocated).
+ * Count bootstrap data as being resident in case any of this data is
+ * later unmapped (using pmap_remove()) and freed.
*/
PMAP_LOCK_INIT(kernel_pmap);
kernel_pmap->pm_pdir = (pd_entry_t *) (KERNBASE + (u_int)IdlePTD);
@@ -408,6 +412,7 @@ pmap_bootstrap(vm_paddr_t firstaddr)
kernel_pmap->pm_pdpt = (pdpt_entry_t *) (KERNBASE + (u_int)IdlePDPT);
#endif
CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */
+ kernel_pmap->pm_stats.resident_count = res;
TAILQ_INIT(&kernel_pmap->pm_pvchunk);
/*
More information about the svn-src-all
mailing list