summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2017-08-03 07:28:54 +0000
committerLuiz Souza <luiz@netgate.com>2018-02-21 15:17:57 -0300
commit5d7057db969c65be347887d98320f74442d9aeff (patch)
treec92230149e79192080d1c2271e4adce2dab2bb44 /sys/sys
parent8e45467a03c7dedb096e314450d0d5579f7df936 (diff)
downloadFreeBSD-src-5d7057db969c65be347887d98320f74442d9aeff.zip
FreeBSD-src-5d7057db969c65be347887d98320f74442d9aeff.tar.gz
MFC r321625:
Make the number of children for pctrie node available outside subr_pctrie.c. (cherry picked from commit e2e84a25a976cfd8cb2558e17386d2fa77887aca)
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/pctrie.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/sys/pctrie.h b/sys/sys/pctrie.h
index 56c1b8c..1fd0b34 100644
--- a/sys/sys/pctrie.h
+++ b/sys/sys/pctrie.h
@@ -133,5 +133,18 @@ pctrie_is_empty(struct pctrie *ptree)
return (ptree->pt_root == 0);
}
+/*
+ * These widths should allow the pointers to a node's children to fit within
+ * a single cache line. The extra levels from a narrow width should not be
+ * a problem thanks to path compression.
+ */
+#ifdef __LP64__
+#define PCTRIE_WIDTH 4
+#else
+#define PCTRIE_WIDTH 3
+#endif
+
+#define PCTRIE_COUNT (1 << PCTRIE_WIDTH)
+
#endif /* _KERNEL */
#endif /* !_SYS_PCTRIE_H_ */
OpenPOWER on IntegriCloud