Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/gen gang_lookup_scan(): if a dense scan and ...



details:   https://anonhg.NetBSD.org/src/rev/75b8eeaffaf2
branches:  trunk
changeset: 1006824:75b8eeaffaf2
user:      ad <ad%NetBSD.org@localhost>
date:      Tue Jan 28 22:20:45 2020 +0000

description:
gang_lookup_scan(): if a dense scan and the first sibling doesn't match,
the scan is finished.

diffstat:

 common/lib/libc/gen/radixtree.c |  28 +++++-----------------------
 1 files changed, 5 insertions(+), 23 deletions(-)

diffs (64 lines):

diff -r 3965d339fba2 -r 75b8eeaffaf2 common/lib/libc/gen/radixtree.c
--- a/common/lib/libc/gen/radixtree.c   Tue Jan 28 20:35:04 2020 +0000
+++ b/common/lib/libc/gen/radixtree.c   Tue Jan 28 22:20:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $        */
+/*     $NetBSD: radixtree.c,v 1.23 2020/01/28 22:20:45 ad Exp $        */
 
 /*-
  * Copyright (c)2011,2012,2013 YAMAMOTO Takashi,
@@ -112,7 +112,7 @@
 #include <sys/cdefs.h>
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.23 2020/01/28 22:20:45 ad Exp $");
 #include <sys/param.h>
 #include <sys/errno.h>
 #include <sys/pool.h>
@@ -122,7 +122,7 @@
 #include <lib/libsa/stand.h>
 #endif /* defined(_STANDALONE) */
 #else /* defined(_KERNEL) || defined(_STANDALONE) */
-__RCSID("$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $");
+__RCSID("$NetBSD: radixtree.c,v 1.23 2020/01/28 22:20:45 ad Exp $");
 #include <assert.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -843,34 +843,16 @@
                        break;
                }
                n = path_node(t, path, lastidx - 1);
-               /*
-                * we used to have an integer counter in the node, and this
-                * optimization made sense then, even though marginal.  it
-                * no longer provides benefit with the structure cache line
-                * aligned and the counter replaced by an unrolled sequence
-                * testing the pointers in batch.
-                */
-#if 0
-               if (*vpp != NULL && radix_tree_node_count_ptrs(n) == 1) {
-                       /*
-                        * optimization; if the node has only a single pointer
-                        * and we've already visited it, there's no point to
-                        * keep scanning in this node.
-                        */
-                       goto no_siblings;
-               }
-#endif /* 0 */
                for (i = vpp - n->n_ptrs + step; i != guard; i += step) {
                        KASSERT(i < RADIX_TREE_PTR_PER_NODE);
                        if (entry_match_p(n->n_ptrs[i], tagmask)) {
                                vpp = &n->n_ptrs[i];
                                break;
+                       } else if (dense) {
+                               return nfound;
                        }
                }
                if (i == guard) {
-#if 0
-no_siblings:
-#endif /* 0 */
                        /*
                         * not found.  go to parent.
                         */



Home | Main Index | Thread Index | Old Index