Module Name: src
Committed By: thorpej
Date: Mon Jul 19 16:31:19 UTC 2021
Modified Files:
src/sys/arch/alpha/alpha: pmap.c
Log Message:
Re-arrange the kernel pmap fast-path in pmap_extract() so that
when DEBUG is not enabled, the compiler can emit a tail-call to
vtophys_internal().
To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/sys/arch/alpha/alpha/pmap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.298 src/sys/arch/alpha/alpha/pmap.c:1.299
--- src/sys/arch/alpha/alpha/pmap.c:1.298 Fri Jul 16 19:02:22 2021
+++ src/sys/arch/alpha/alpha/pmap.c Mon Jul 19 16:31:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.298 2021/07/16 19:02:22 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.298 2021/07/16 19:02:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2578,18 +2578,18 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
* handles K0SEG.
*/
if (__predict_true(pmap == pmap_kernel())) {
- if (__predict_true(vtophys_internal(va, pap))) {
#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
+ bool address_is_valid = vtophys_internal(va, pap);
+ if (pmapdebug & PDB_FOLLOW) {
+ if (address_is_valid) {
printf("0x%lx (kernel vtophys)\n", *pap);
-#endif
- return true;
+ } else {
+ printf("failed (kernel vtophys)\n");
+ }
}
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("failed (kernel vtophys)\n");
+#else
+ return vtophys_internal(va, pap);
#endif
- return false;
}
pt_entry_t * const lev1map = pmap_lev1map(pmap);