Tue Jan 28 22:20:45 2020 UTC ()
gang_lookup_scan(): if a dense scan and the first sibling doesn't match,
the scan is finished.


(ad)
diff -r1.22 -r1.23 src/common/lib/libc/gen/radixtree.c

cvs diff -r1.22 -r1.23 src/common/lib/libc/gen/radixtree.c (expand / switch to context diff)
--- src/common/lib/libc/gen/radixtree.c 2020/01/28 16:33:34 1.22
+++ src/common/lib/libc/gen/radixtree.c 2020/01/28 22:20:45 1.23
@@ -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.
 			 */