summaryrefslogtreecommitdiffstats
path: root/sys/vm/uma_int.h
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-09-18 08:26:30 +0000
committerjeff <jeff@FreeBSD.org>2002-09-18 08:26:30 +0000
commitaeb98331c1a874e05cc0e4d1ab335e18db4fced3 (patch)
treefeefa57915c5e60939c1c6cc8fe31011cf7d6971 /sys/vm/uma_int.h
parent705073e549c7036c4006757ad236734705c8778d (diff)
downloadFreeBSD-src-aeb98331c1a874e05cc0e4d1ab335e18db4fced3.zip
FreeBSD-src-aeb98331c1a874e05cc0e4d1ab335e18db4fced3.tar.gz
- Split UMA_ZFLAG_OFFPAGE into UMA_ZFLAG_OFFPAGE and UMA_ZFLAG_HASH.
- Remove all instances of the mallochash. - Stash the slab pointer in the vm page's object pointer when allocating from the kmem_obj. - Use the overloaded object pointer to find slabs for malloced memory.
Diffstat (limited to 'sys/vm/uma_int.h')
-rw-r--r--sys/vm/uma_int.h39
1 files changed, 35 insertions, 4 deletions
diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h
index cf6dc39..f4c3fe8 100644
--- a/sys/vm/uma_int.h
+++ b/sys/vm/uma_int.h
@@ -103,8 +103,6 @@
#ifndef VM_UMA_INT_H
#define VM_UMA_INT_H
-#include <sys/mutex.h>
-
#define UMA_SLAB_SIZE PAGE_SIZE /* How big are our slabs? */
#define UMA_SLAB_MASK (PAGE_SIZE - 1) /* Mask to get back to the page */
#define UMA_SLAB_SHIFT PAGE_SHIFT /* Number of bits PAGE_MASK */
@@ -175,8 +173,6 @@ struct uma_hash {
int uh_hashmask; /* Mask used during hashing */
};
-extern struct uma_hash *mallochash;
-
/*
* Structures for per cpu queues.
*/
@@ -274,6 +270,7 @@ struct uma_zone {
#define UMA_ZFLAG_NOFREE 0x0010 /* Don't free data from this zone */
#define UMA_ZFLAG_FULL 0x0020 /* This zone reached uz_maxpages */
#define UMA_ZFLAG_BUCKETCACHE 0x0040 /* Only allocate buckets from cache */
+#define UMA_ZFLAG_HASH 0x0080 /* Look up slab via hash */
/* This lives in uflags */
#define UMA_ZONE_INTERNAL 0x1000 /* Internal zone for uflags */
@@ -346,5 +343,39 @@ hash_sfind(struct uma_hash *hash, u_int8_t *data)
return (NULL);
}
+static __inline uma_slab_t
+vtoslab(vm_offset_t va)
+{
+ vm_page_t p;
+ uma_slab_t slab;
+
+ p = PHYS_TO_VM_PAGE(pmap_kextract(va));
+ slab = (uma_slab_t )p->object;
+
+ if (p->flags & PG_SLAB)
+ return (slab);
+ else
+ return (NULL);
+}
+
+static __inline void
+vsetslab(vm_offset_t va, uma_slab_t slab)
+{
+ vm_page_t p;
+
+ p = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)va));
+ p->object = (vm_object_t)slab;
+ p->flags |= PG_SLAB;
+}
+
+static __inline void
+vsetobj(vm_offset_t va, vm_object_t obj)
+{
+ vm_page_t p;
+
+ p = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)va));
+ p->object = obj;
+ p->flags &= ~PG_SLAB;
+}
#endif /* VM_UMA_INT_H */
OpenPOWER on IntegriCloud