]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Correct some inconsistencies in the earliest created kernel page
authorkib <kib@FreeBSD.org>
Mon, 27 May 2019 15:21:26 +0000 (15:21 +0000)
committerkib <kib@FreeBSD.org>
Mon, 27 May 2019 15:21:26 +0000 (15:21 +0000)
commitf5100e0445e628b94031d6a64cd976f0162790ac
tree4d539e04572c09018cc8153e5db73d83595c3081
parent48d24993fc5a15ee173e9eb9211a7f9b4e661337
Correct some inconsistencies in the earliest created kernel page
tables which affect demotion.

The last last-level page table under 2M mappings below KERNend was
only partially initialized.  When that page was used as the hardware
page table for demotion of the 2M mapping, the result was not
consistent.  Since pmap_demote_pde() is switched to use PG_PROMOTED as
the test for the validity of the saved last level page table page, we
can keep page table pages zero-initialized instead.  Demotion would
fill them as needed.

Only map the created page tables beyond KERNend, there is no need to
pre-promote PTmap after KERNend, because the extra mapping is not used.

Only round up *firstaddr to 2M boundary when it is below rounded
KERNend.  Sometimes the allocpages() calls advance *firstaddr past the
end of the last 2MB page mapping. In that case, this conditional
avoids wasting an average of 1MB of physical memory.

Update comments to explain action in more clean and direct language.

Reported and tested by: pho
In collaboration with: alc
Sponsored by: The FreeBSD Foundation (kib)
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20380
sys/amd64/amd64/pmap.c