diff options
author | Alan Cox <alc@FreeBSD.org> | 2021-07-12 23:25:37 +0000 |
---|---|---|
committer | Alan Cox <alc@FreeBSD.org> | 2021-07-13 22:33:23 +0000 |
commit | d411b285bc293a37e062d8fb15b85212ce16abab (patch) | |
tree | 0f9f3c2e6ff19c324bc6537abaa9f34711fec798 /sys/amd64/amd64/pmap.c | |
parent | 4a9a41650c909706bc0b9a3f29817c11b262b0a0 (diff) | |
download | src-d411b285bc293a37e062d8fb15b85212ce16abab.tar.gz src-d411b285bc293a37e062d8fb15b85212ce16abab.zip |
pmap: Micro-optimize pmap_remove_pages() on amd64 and arm64
Reduce the live ranges for three variables so that they do not span the
call to PHYS_TO_VM_PAGE(). This enables the compiler to generate
slightly smaller machine code.
Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31161
Diffstat (limited to 'sys/amd64/amd64/pmap.c')
-rw-r--r-- | sys/amd64/amd64/pmap.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index f8bd17dc6238..31681e255af1 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -8201,6 +8201,16 @@ pmap_remove_pages(pmap_t pmap) continue; } + /* Mark free */ + pc->pc_map[field] |= bitmask; + + /* + * Because this pmap is not active on other + * processors, the dirty bit cannot have + * changed state since we last loaded pte. + */ + pte_clear(pte); + if (superpage) pa = tpte & PG_PS_FRAME; else @@ -8217,8 +8227,6 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: bad tpte %#jx", (uintmax_t)tpte)); - pte_clear(pte); - /* * Update the vm_page_t clean/reference bits. */ @@ -8232,8 +8240,6 @@ pmap_remove_pages(pmap_t pmap) CHANGE_PV_LIST_LOCK_TO_VM_PAGE(&lock, m); - /* Mark free */ - pc->pc_map[field] |= bitmask; if (superpage) { pmap_resident_count_adj(pmap, -NBPDR / PAGE_SIZE); pvh = pa_to_pvh(tpte & PG_PS_FRAME); |