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
This commit is contained in:
Mark Johnston 2018-10-01 18:48:33 +00:00
parent 953cba365f
commit cb4961abc1
2 changed files with 8 additions and 2 deletions

View File

@ -1142,7 +1142,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
/* /*
* Initialize the kernel pmap (which is statically allocated). * 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); PMAP_LOCK_INIT(kernel_pmap);
kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys); kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys);

View File

@ -579,8 +579,11 @@ pmap_bootstrap(vm_paddr_t firstaddr)
vm_offset_t va; vm_offset_t va;
pt_entry_t *pte, *unused; pt_entry_t *pte, *unused;
struct pcpu *pc; struct pcpu *pc;
u_long res;
int i; int i;
res = atop(firstaddr - (vm_paddr_t)KERNLOAD);
/* /*
* Add a physical memory segment (vm_phys_seg) corresponding to the * Add a physical memory segment (vm_phys_seg) corresponding to the
* preallocated kernel page table pages so that vm_page structures * 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". * unused virtual address in addition to "firstaddr".
*/ */
virtual_avail = (vm_offset_t)firstaddr; virtual_avail = (vm_offset_t)firstaddr;
virtual_end = VM_MAX_KERNEL_ADDRESS; virtual_end = VM_MAX_KERNEL_ADDRESS;
/* /*
* Initialize the kernel pmap (which is statically allocated). * 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); PMAP_LOCK_INIT(kernel_pmap);
kernel_pmap->pm_pdir = IdlePTD; kernel_pmap->pm_pdir = IdlePTD;
@ -610,6 +614,7 @@ pmap_bootstrap(vm_paddr_t firstaddr)
kernel_pmap->pm_pdpt = IdlePDPT; kernel_pmap->pm_pdpt = IdlePDPT;
#endif #endif
CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */
kernel_pmap->pm_stats.resident_count = res;
TAILQ_INIT(&kernel_pmap->pm_pvchunk); TAILQ_INIT(&kernel_pmap->pm_pvchunk);
/* /*