diff options
author | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-07-01 03:28:54 +0000 |
---|---|---|
committer | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-07-01 03:28:54 +0000 |
commit | a1502d76aef90d32ac779c1ae3cf89a80d9d591d (patch) | |
tree | 75e127952d0cbe21b967031e021aacc63366110f /include/sys | |
parent | 1c3832576db0f692ec066b4059feb4a9a695a575 (diff) |
- Remove hash functionality from slab in favor of direct lookups
based of the spl_kmem_obj_t tacked on the end of each object.
This actually isn't so back because we are now allocing large
chunks for the slab and partitioning it ourselves. So there's
not a ton of wasted space. We may suffer a performance hit
however due to alignment issues.
- Remove remaining depenancies on the linux slab implementation.
We're standing on our own now for better or worse.
- Rework slabs to be either kmem or vmem based. If neither
KMC_VMEM of KMC_KMEM are specified we make a decent guess
about what will work best for their based on the object
size. Additionally we provide a kmem_virt() function caller
can use to see if they have a virtual or physical address.
- Minor fixups in the test suite.
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@141 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/kmem.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/include/sys/kmem.h b/include/sys/kmem.h index b90e3fdaf..9397caa0a 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -403,11 +403,14 @@ kmem_alloc_tryhard(size_t size, size_t *alloc_size, int kmflags) /* * Slab allocation interfaces */ -#undef KMC_NOTOUCH /* XXX: Unsupported */ -#define KMC_NODEBUG 0x00000000 /* Default behavior */ -#define KMC_NOMAGAZINE /* XXX: Unsupported */ -#define KMC_NOHASH /* XXX: Unsupported */ -#define KMC_QCACHE /* XXX: Unsupported */ +#define KMC_NOTOUCH 0x00000001 +#define KMC_NODEBUG 0x00000002 /* Default behavior */ +#define KMC_NOMAGAZINE 0x00000004 /* XXX: No disable support available */ +#define KMC_NOHASH 0x00000008 /* XXX: No hash available */ +#define KMC_QCACHE 0x00000010 /* XXX: Unsupported */ +#define KMC_KMEM 0x00000100 /* Use kmem cache */ +#define KMC_VMEM 0x00000200 /* Use vmem cache */ +#define KMC_OFFSLAB 0x00000400 /* Objects not on slab */ #define KMC_REAP_CHUNK 256 #define KMC_DEFAULT_SEEKS DEFAULT_SEEKS @@ -462,11 +465,6 @@ extern struct rw_semaphore spl_kmem_cache_sem; #define SKS_MAGIC 0x22222222 #define SKC_MAGIC 0x2c2c2c2c -#define SPL_KMEM_CACHE_HASH_BITS 12 -#define SPL_KMEM_CACHE_HASH_ELTS (1 << SPL_KMEM_CACHE_HASH_BITS) -#define SPL_KMEM_CACHE_HASH_SIZE (sizeof(struct hlist_head) * \ - SPL_KMEM_CACHE_HASH_ELTS) - #define SPL_KMEM_CACHE_DELAY 5 #define SPL_KMEM_CACHE_OBJ_PER_SLAB 32 @@ -488,7 +486,6 @@ typedef struct spl_kmem_obj { void *sko_addr; /* Buffer address */ struct spl_kmem_slab *sko_slab; /* Owned by slab */ struct list_head sko_list; /* Free object list linkage */ - struct hlist_node sko_hlist; /* Used object hash linkage */ } spl_kmem_obj_t; typedef struct spl_kmem_slab { @@ -515,14 +512,9 @@ typedef struct spl_kmem_cache { void *skc_vmp; /* Unused */ uint32_t skc_flags; /* Flags */ uint32_t skc_obj_size; /* Object size */ - uint32_t skc_chunk_size; /* sizeof(*obj) + alignment */ - uint32_t skc_slab_size; /* slab size */ - uint32_t skc_max_chunks; /* max chunks per slab */ + uint32_t skc_slab_objs; /* Objects per slab */ + uint32_t skc_slab_size; /* Slab size */ uint32_t skc_delay; /* slab reclaim interval */ - uint32_t skc_hash_bits; /* Hash table bits */ - uint32_t skc_hash_size; /* Hash table size */ - uint32_t skc_hash_elts; /* Hash table elements */ - struct hlist_head *skc_hash; /* Hash table address */ struct list_head skc_list; /* List of caches linkage */ struct list_head skc_complete_list;/* Completely alloc'ed */ struct list_head skc_partial_list; /* Partially alloc'ed */ @@ -536,8 +528,6 @@ typedef struct spl_kmem_cache { uint64_t skc_obj_total; /* Obj total current */ uint64_t skc_obj_alloc; /* Obj alloc current */ uint64_t skc_obj_max; /* Obj max historic */ - uint64_t skc_hash_depth; /* Lazy hash depth */ - uint64_t skc_hash_count; /* Hash entries current */ } spl_kmem_cache_t; extern spl_kmem_cache_t * @@ -561,6 +551,8 @@ void spl_kmem_fini(void); #define kmem_cache_free(skc, obj) spl_kmem_cache_free(skc, obj) #define kmem_cache_reap_now(skc) spl_kmem_cache_reap_now(skc) #define kmem_reap() spl_kmem_reap() +#define kmem_virt(ptr) (((ptr) >= (void *)VMALLOC_START) && \ + ((ptr) < (void *)VMALLOC_END)) #ifdef HAVE_KMEM_CACHE_CREATE_DTOR #define __kmem_cache_create(name, size, align, flags, ctor, dtor) \ |