summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2017-07-26 06:52:45 +0000
committerLuiz Souza <luiz@netgate.com>2018-02-21 15:17:45 -0300
commitf28f67fd35108771c42f6916597ddee03281a2f4 (patch)
treec8427b81b5ff6234c3f60f5dd459726858a403ee
parent44d43dcf1789fec27f271fe4e9175e1a297736d9 (diff)
downloadFreeBSD-src-f28f67fd35108771c42f6916597ddee03281a2f4.zip
FreeBSD-src-f28f67fd35108771c42f6916597ddee03281a2f4.tar.gz
MFC r321247:
Add pctrie_init() and vm_radix_init() to initialize generic pctrie and vm_radix trie. (cherry picked from commit 449ea22b392f956d4af1311d01e6ca647ebda976)
-rw-r--r--sys/sys/_pctrie.h10
-rw-r--r--sys/sys/pctrie.h14
-rw-r--r--sys/vm/_vm_radix.h10
-rw-r--r--sys/vm/vm_object.c4
-rw-r--r--sys/vm/vm_radix.c2
-rw-r--r--sys/vm/vm_radix.h16
6 files changed, 32 insertions, 24 deletions
diff --git a/sys/sys/_pctrie.h b/sys/sys/_pctrie.h
index 45f69b2..c6d13ba 100644
--- a/sys/sys/_pctrie.h
+++ b/sys/sys/_pctrie.h
@@ -38,14 +38,4 @@ struct pctrie {
uintptr_t pt_root;
};
-#ifdef _KERNEL
-
-static __inline boolean_t
-pctrie_is_empty(struct pctrie *ptree)
-{
-
- return (ptree->pt_root == 0);
-}
-
-#endif /* _KERNEL */
#endif /* !__SYS_PCTRIE_H_ */
diff --git a/sys/sys/pctrie.h b/sys/sys/pctrie.h
index f736877..0c0af30 100644
--- a/sys/sys/pctrie.h
+++ b/sys/sys/pctrie.h
@@ -119,5 +119,19 @@ void pctrie_remove(struct pctrie *ptree, uint64_t key,
size_t pctrie_node_size(void);
int pctrie_zone_init(void *mem, int size, int flags);
+static __inline void
+pctrie_init(struct pctrie *ptree)
+{
+
+ ptree->pt_root = 0;
+}
+
+static __inline boolean_t
+pctrie_is_empty(struct pctrie *ptree)
+{
+
+ return (ptree->pt_root == 0);
+}
+
#endif /* _KERNEL */
#endif /* !_SYS_PCTRIE_H_ */
diff --git a/sys/vm/_vm_radix.h b/sys/vm/_vm_radix.h
index f066462..f061a5f 100644
--- a/sys/vm/_vm_radix.h
+++ b/sys/vm/_vm_radix.h
@@ -38,14 +38,4 @@ struct vm_radix {
uintptr_t rt_root;
};
-#ifdef _KERNEL
-
-static __inline boolean_t
-vm_radix_is_empty(struct vm_radix *rtree)
-{
-
- return (rtree->rt_root == 0);
-}
-
-#endif /* _KERNEL */
#endif /* !__VM_RADIX_H_ */
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 39c98c2..8ceee4e 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -205,7 +205,7 @@ vm_object_zinit(void *mem, int size, int flags)
/* These are true for any object that has been freed */
object->type = OBJT_DEAD;
object->ref_count = 0;
- object->rtree.rt_root = 0;
+ vm_radix_init(&object->rtree);
object->paging_in_progress = 0;
object->resident_page_count = 0;
object->shadow_count = 0;
@@ -313,7 +313,7 @@ vm_object_init(void)
#endif
vm_object_zinit, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
- vm_radix_init();
+ vm_radix_zinit();
}
void
diff --git a/sys/vm/vm_radix.c b/sys/vm/vm_radix.c
index 4f0a575..1a19dd9 100644
--- a/sys/vm/vm_radix.c
+++ b/sys/vm/vm_radix.c
@@ -310,7 +310,7 @@ SYSINIT(vm_radix_reserve_kva, SI_SUB_KMEM, SI_ORDER_THIRD,
* Initialize the UMA slab zone.
*/
void
-vm_radix_init(void)
+vm_radix_zinit(void)
{
vm_radix_node_zone = uma_zcreate("RADIX NODE",
diff --git a/sys/vm/vm_radix.h b/sys/vm/vm_radix.h
index b8a722d..d96e50b 100644
--- a/sys/vm/vm_radix.h
+++ b/sys/vm/vm_radix.h
@@ -35,7 +35,6 @@
#ifdef _KERNEL
-void vm_radix_init(void);
int vm_radix_insert(struct vm_radix *rtree, vm_page_t page);
boolean_t vm_radix_is_singleton(struct vm_radix *rtree);
vm_page_t vm_radix_lookup(struct vm_radix *rtree, vm_pindex_t index);
@@ -44,6 +43,21 @@ vm_page_t vm_radix_lookup_le(struct vm_radix *rtree, vm_pindex_t index);
void vm_radix_reclaim_allnodes(struct vm_radix *rtree);
vm_page_t vm_radix_remove(struct vm_radix *rtree, vm_pindex_t index);
vm_page_t vm_radix_replace(struct vm_radix *rtree, vm_page_t newpage);
+void vm_radix_zinit(void);
+
+static __inline void
+vm_radix_init(struct vm_radix *rtree)
+{
+
+ rtree->rt_root = 0;
+}
+
+static __inline boolean_t
+vm_radix_is_empty(struct vm_radix *rtree)
+{
+
+ return (rtree->rt_root == 0);
+}
#endif /* _KERNEL */
#endif /* !_VM_RADIX_H_ */
OpenPOWER on IntegriCloud