Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/alpha Re-arrange the kernel pmap fast-path in...



details:   https://anonhg.NetBSD.org/src/rev/73bb66494af0
branches:  trunk
changeset: 1022450:73bb66494af0
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jul 19 16:31:19 2021 +0000

description:
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().

diffstat:

 sys/arch/alpha/alpha/pmap.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (46 lines):

diff -r 5514ffa3e0b9 -r 73bb66494af0 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c       Mon Jul 19 16:25:54 2021 +0000
+++ b/sys/arch/alpha/alpha/pmap.c       Mon Jul 19 16:31:19 2021 +0000
@@ -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 @@
         * 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);
+                       } else {
+                               printf("failed (kernel vtophys)\n");
+                       }
+               }
+#else
+               return vtophys_internal(va, pap);
 #endif
-                       return true;
-               }
-#ifdef DEBUG
-               if (pmapdebug & PDB_FOLLOW)
-                       printf("failed (kernel vtophys)\n");
-#endif
-               return false;
        }
 
        pt_entry_t * const lev1map = pmap_lev1map(pmap);



Home | Main Index | Thread Index | Old Index