aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/amd64
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-10-20 00:29:18 +0000
committerMark Johnston <markj@FreeBSD.org>2021-10-20 01:22:57 +0000
commit34fac29e98313fb0bfba0503e2e19e352b452516 (patch)
treeb85213abad7f5e62051107136bf11dc638f1f723 /sys/amd64/amd64
parentff93447d8ed61081adfe00a23a1e4c7bee479e53 (diff)
downloadsrc-34fac29e98313fb0bfba0503e2e19e352b452516.tar.gz
src-34fac29e98313fb0bfba0503e2e19e352b452516.zip
amd64: Add comments to pmap_pinit_type()
... explaining why we don't pass the pmap pointer to pmap_alloc_pt_page(). Reported by: alc Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32528
Diffstat (limited to 'sys/amd64/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 8d6379ab170c..66d7ac6669da 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4345,7 +4345,9 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags)
int i;
/*
- * allocate the page directory page
+ * Allocate the page directory page. Pass NULL instead of a pointer to
+ * the pmap here to avoid recording this page in the resident count, as
+ * optimizations in pmap_remove() depend on this.
*/
pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO |
VM_ALLOC_WAITOK);
@@ -4377,6 +4379,10 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags)
else
pmap_pinit_pml4(pmltop_pg);
if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) {
+ /*
+ * As with pmltop_pg, pass NULL instead of a pointer to
+ * the pmap to ensure that the PTI page isn't counted.
+ */
pmltop_pgu = pmap_alloc_pt_page(NULL, 0,
VM_ALLOC_WIRED | VM_ALLOC_WAITOK);
pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP(