svn commit: r339073 - in head/sys: amd64/amd64 i386/i386
Mark Johnston
markj at FreeBSD.org
Mon Oct 1 18:48:34 UTC 2018
Author: markj
Date: Mon Oct 1 18:48:33 2018
New Revision: 339073
URL: https://svnweb.freebsd.org/changeset/base/339073
Log:
Apply r339046 to i386.
Belatedly add a comment to the amd64 pmap explaining why we initialize
the kernel pmap's resident page count.
Reviewed by: alc, kib
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17377
Modified:
head/sys/amd64/amd64/pmap.c
head/sys/i386/i386/pmap.c
Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c Mon Oct 1 18:46:35 2018 (r339072)
+++ head/sys/amd64/amd64/pmap.c Mon Oct 1 18:48:33 2018 (r339073)
@@ -1142,7 +1142,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
/*
* Initialize the kernel pmap (which is statically allocated).
- * Count bootstrap data as being resident.
+ * 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);
Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c Mon Oct 1 18:46:35 2018 (r339072)
+++ head/sys/i386/i386/pmap.c Mon Oct 1 18:48:33 2018 (r339073)
@@ -579,8 +579,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
@@ -598,11 +601,12 @@ pmap_bootstrap(vm_paddr_t firstaddr)
* unused virtual address in addition to "firstaddr".
*/
virtual_avail = (vm_offset_t)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 = IdlePTD;
@@ -610,6 +614,7 @@ pmap_bootstrap(vm_paddr_t firstaddr)
kernel_pmap->pm_pdpt = 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-head
mailing list