Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150495859
D40585.id123373.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40585.id123373.diff
View Options
Index: sys/kern/subr_pctrie.c
===================================================================
--- sys/kern/subr_pctrie.c
+++ sys/kern/subr_pctrie.c
@@ -53,6 +53,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/libkern.h>
#include <sys/kernel.h>
#include <sys/pctrie.h>
#include <sys/proc.h> /* smr.h depends on struct thread. */
@@ -265,15 +266,11 @@
static __inline uint16_t
pctrie_keydiff(uint64_t index1, uint64_t index2)
{
- uint16_t clev;
KASSERT(index1 != index2, ("%s: passing the same key value %jx",
__func__, (uintmax_t)index1));
- index1 ^= index2;
- for (clev = PCTRIE_LIMIT;; clev--)
- if (pctrie_slot(index1, clev) != 0)
- return (clev);
+ return ((flsl(index1 ^ index2) - 1) / PCTRIE_WIDTH);
}
/*
Index: sys/vm/vm_radix.c
===================================================================
--- sys/vm/vm_radix.c
+++ sys/vm/vm_radix.c
@@ -57,6 +57,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/libkern.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/vmmeter.h>
@@ -291,15 +292,11 @@
static __inline uint16_t
vm_radix_keydiff(vm_pindex_t index1, vm_pindex_t index2)
{
- uint16_t clev;
KASSERT(index1 != index2, ("%s: passing the same key value %jx",
__func__, (uintmax_t)index1));
- index1 ^= index2;
- for (clev = VM_RADIX_LIMIT;; clev--)
- if (vm_radix_slot(index1, clev) != 0)
- return (clev);
+ return ((flsl(index1 ^ index2) - 1) / VM_RADIX_WIDTH);
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 2, 5:25 PM (12 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30696641
Default Alt Text
D40585.id123373.diff (1 KB)
Attached To
Mode
D40585: radix_trie: eliminate iteration in keydiff
Attached
Detach File
Event Timeline
Log In to Comment