Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162581629
D40723.id123669.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D40723.id123669.diff
View Options
Index: sys/kern/subr_pctrie.c
===================================================================
--- sys/kern/subr_pctrie.c
+++ sys/kern/subr_pctrie.c
@@ -92,13 +92,37 @@
static __inline void pctrie_node_store(smr_pctnode_t *p, void *val,
enum pctrie_access access);
+/*
+ * Return the position in the array for a given level.
+ */
+static __inline int
+pctrie_slot(uint64_t index, uint16_t level)
+{
+
+ return ((index >> (level * PCTRIE_WIDTH)) & PCTRIE_MASK);
+}
+
+/* Trims the key after the specified level. */
+static __inline uint64_t
+pctrie_trimkey(uint64_t index, uint16_t level)
+{
+ uint64_t ret;
+
+ ret = index;
+ if (level > 0) {
+ ret >>= level * PCTRIE_WIDTH;
+ ret <<= level * PCTRIE_WIDTH;
+ }
+ return (ret);
+}
+
/*
* Allocate a node. Pre-allocation should ensure that the request
* will always be satisfied.
*/
static struct pctrie_node *
-pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t allocfn, uint64_t owner,
- uint16_t count, uint16_t clevel)
+pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t allocfn, uint64_t index,
+ uint16_t clevel)
{
struct pctrie_node *node;
@@ -116,8 +140,8 @@
PCTRIE_UNSERIALIZED);
node->pn_last = 0;
}
- node->pn_owner = owner;
- node->pn_count = count;
+ node->pn_owner = pctrie_trimkey(index, clevel + 1);
+ node->pn_count = 2;
node->pn_clev = clevel;
return (node);
}
@@ -146,30 +170,6 @@
freefn(ptree, node);
}
-/*
- * Return the position in the array for a given level.
- */
-static __inline int
-pctrie_slot(uint64_t index, uint16_t level)
-{
-
- return ((index >> (level * PCTRIE_WIDTH)) & PCTRIE_MASK);
-}
-
-/* Trims the key after the specified level. */
-static __inline uint64_t
-pctrie_trimkey(uint64_t index, uint16_t level)
-{
- uint64_t ret;
-
- ret = index;
- if (level > 0) {
- ret >>= level * PCTRIE_WIDTH;
- ret <<= level * PCTRIE_WIDTH;
- }
- return (ret);
-}
-
/*
* Fetch a node pointer from a slot.
*/
@@ -374,8 +374,7 @@
panic("%s: key %jx is already present",
__func__, (uintmax_t)index);
clev = pctrie_keydiff(*m, index);
- tmp = pctrie_node_get(ptree, allocfn,
- pctrie_trimkey(index, clev + 1), 2, clev);
+ tmp = pctrie_node_get(ptree, allocfn, index, clev);
if (tmp == NULL)
return (ENOMEM);
/* These writes are not yet visible due to ordering. */
@@ -406,8 +405,7 @@
*/
newind = node->pn_owner;
clev = pctrie_keydiff(newind, index);
- tmp = pctrie_node_get(ptree, allocfn,
- pctrie_trimkey(index, clev + 1), 2, clev);
+ tmp = pctrie_node_get(ptree, allocfn, index, clev);
if (tmp == NULL)
return (ENOMEM);
slot = pctrie_slot(newind, clev);
Index: sys/vm/vm_radix.c
===================================================================
--- sys/vm/vm_radix.c
+++ sys/vm/vm_radix.c
@@ -119,11 +119,35 @@
static void vm_radix_node_store(smrnode_t *p, struct vm_radix_node *v,
enum vm_radix_access access);
+/*
+ * Return the position in the array for a given level.
+ */
+static __inline int
+vm_radix_slot(vm_pindex_t index, uint16_t level)
+{
+
+ return ((index >> (level * VM_RADIX_WIDTH)) & VM_RADIX_MASK);
+}
+
+/* Trims the key after the specified level. */
+static __inline vm_pindex_t
+vm_radix_trimkey(vm_pindex_t index, uint16_t level)
+{
+ vm_pindex_t ret;
+
+ ret = index;
+ if (level > 0) {
+ ret >>= level * VM_RADIX_WIDTH;
+ ret <<= level * VM_RADIX_WIDTH;
+ }
+ return (ret);
+}
+
/*
* Allocate a radix node.
*/
static struct vm_radix_node *
-vm_radix_node_get(vm_pindex_t owner, uint16_t count, uint16_t clevel)
+vm_radix_node_get(vm_pindex_t index, uint16_t clevel)
{
struct vm_radix_node *rnode;
@@ -141,8 +165,8 @@
NULL, UNSERIALIZED);
rnode->rn_last = 0;
}
- rnode->rn_owner = owner;
- rnode->rn_count = count;
+ rnode->rn_owner = vm_radix_trimkey(index, clevel + 1);
+ rnode->rn_count = 2;
rnode->rn_clev = clevel;
return (rnode);
}
@@ -171,30 +195,6 @@
uma_zfree_smr(vm_radix_node_zone, rnode);
}
-/*
- * Return the position in the array for a given level.
- */
-static __inline int
-vm_radix_slot(vm_pindex_t index, uint16_t level)
-{
-
- return ((index >> (level * VM_RADIX_WIDTH)) & VM_RADIX_MASK);
-}
-
-/* Trims the key after the specified level. */
-static __inline vm_pindex_t
-vm_radix_trimkey(vm_pindex_t index, uint16_t level)
-{
- vm_pindex_t ret;
-
- ret = index;
- if (level > 0) {
- ret >>= level * VM_RADIX_WIDTH;
- ret <<= level * VM_RADIX_WIDTH;
- }
- return (ret);
-}
-
/*
* Fetch a node pointer from a slot in another node.
*/
@@ -413,8 +413,7 @@
panic("%s: key %jx is already present",
__func__, (uintmax_t)index);
clev = vm_radix_keydiff(m->pindex, index);
- tmp = vm_radix_node_get(vm_radix_trimkey(index,
- clev + 1), 2, clev);
+ tmp = vm_radix_node_get(index, clev);
if (tmp == NULL)
return (ENOMEM);
/* These writes are not yet visible due to ordering. */
@@ -444,7 +443,7 @@
*/
newind = rnode->rn_owner;
clev = vm_radix_keydiff(newind, index);
- tmp = vm_radix_node_get(vm_radix_trimkey(index, clev + 1), 2, clev);
+ tmp = vm_radix_node_get(index, clev);
if (tmp == NULL)
return (ENOMEM);
slot = vm_radix_slot(newind, clev);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 15, 6:29 PM (5 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35110153
Default Alt Text
D40723.id123669.diff (5 KB)
Attached To
Mode
D40723: radix_trie: pass fewer params to node_get
Attached
Detach File
Event Timeline
Log In to Comment