git: 03ca8ea0cc9f - main - amd64/arm64 pmap: Mark pmap_enter()'s large page case unlikely
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Nov 2026 19:42:40 UTC
The branch main has been updated by alc:
URL: https://cgit.FreeBSD.org/src/commit/?id=03ca8ea0cc9fb5aa535ade1ef3c4ceefc0a9a95b
commit 03ca8ea0cc9fb5aa535ade1ef3c4ceefc0a9a95b
Author: Alan Cox <alc@FreeBSD.org>
AuthorDate: 2026-11-22 20:29:55 +0000
Commit: Alan Cox <alc@FreeBSD.org>
CommitDate: 2026-11-24 18:15:45 +0000
amd64/arm64 pmap: Mark pmap_enter()'s large page case unlikely
PMAP_ENTER_LARGEPAGE is only used to map non-transparent large page
shared memory objects. Tell the compiler that this case is unlikely.
This hint stops pmap_enter_largepage() from being inlined into
pmap_enter(), which shortens pmap_enter()'s more common execution path
on both amd64 and arm64.
MFC after: 1 week
---
sys/amd64/amd64/pmap.c | 2 +-
sys/arm64/arm64/pmap.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 69898ab491e7..d745cceb6651 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -7165,7 +7165,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
lock = NULL;
PMAP_LOCK(pmap);
- if ((flags & PMAP_ENTER_LARGEPAGE) != 0) {
+ if (__predict_false((flags & PMAP_ENTER_LARGEPAGE) != 0)) {
KASSERT((m->oflags & VPO_UNMANAGED) != 0,
("managed largepage va %#lx flags %#x", va, flags));
rv = pmap_enter_largepage(pmap, va, newpte | PG_PS, flags,
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 0e22db5f0493..8a8b7972105d 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -5895,7 +5895,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
lock = NULL;
PMAP_LOCK(pmap);
- if ((flags & PMAP_ENTER_LARGEPAGE) != 0) {
+ if (__predict_false((flags & PMAP_ENTER_LARGEPAGE) != 0)) {
KASSERT((m->oflags & VPO_UNMANAGED) != 0,
("managed largepage va %#lx flags %#x", va, flags));
if (psind == 3) {