Skip to content

Commit

Permalink
remove KMC_VMEM
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrens committed Aug 4, 2020
1 parent c0c3ae9 commit d83c271
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 74 deletions.
2 changes: 0 additions & 2 deletions include/os/linux/spl/sys/kmem_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ typedef enum kmc_bit {
KMC_BIT_NOMAGAZINE = 2, /* XXX: Unsupported */
KMC_BIT_NOHASH = 3, /* XXX: Unsupported */
KMC_BIT_QCACHE = 4, /* XXX: Unsupported */
KMC_BIT_VMEM = 6, /* Use vmem cache */
KMC_BIT_KVMEM = 7, /* Use kvmalloc linux allocator */
KMC_BIT_SLAB = 8, /* Use Linux slab cache */
KMC_BIT_OFFSLAB = 9, /* Objects not on slab */
Expand All @@ -68,7 +67,6 @@ typedef enum kmem_cbrc {
#define KMC_NOMAGAZINE (1 << KMC_BIT_NOMAGAZINE)
#define KMC_NOHASH (1 << KMC_BIT_NOHASH)
#define KMC_QCACHE (1 << KMC_BIT_QCACHE)
#define KMC_VMEM (1 << KMC_BIT_VMEM)
#define KMC_KVMEM (1 << KMC_BIT_KVMEM)
#define KMC_SLAB (1 << KMC_BIT_SLAB)
#define KMC_OFFSLAB (1 << KMC_BIT_OFFSLAB)
Expand Down
1 change: 0 additions & 1 deletion include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ void procfs_list_add(procfs_list_t *procfs_list, void *p);
#define KM_NOSLEEP UMEM_DEFAULT
#define KM_NORMALPRI 0 /* not needed with UMEM_DEFAULT */
#define KMC_NODEBUG UMC_NODEBUG
#define KMC_VMEM 0x0
#define KMC_KVMEM 0x0
#define kmem_alloc(_s, _f) umem_alloc(_s, _f)
#define kmem_zalloc(_s, _f) umem_zalloc(_s, _f)
Expand Down
27 changes: 0 additions & 27 deletions module/os/freebsd/spl/spl_zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,30 +240,3 @@ z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen)

return (err);
}

#if 0
int
spl_zlib_init(void)
{
int size;

size = MAX(spl_zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
zlib_inflate_workspacesize());

zlib_workspace_cache = kmem_cache_create(
"spl_zlib_workspace_cache",
size, 0, NULL, NULL, NULL, NULL, NULL,
KMC_VMEM | KMC_NOEMERGENCY);
if (!zlib_workspace_cache)
return (1);

return (0);
}

void
spl_zlib_fini(void)
{
kmem_cache_destroy(zlib_workspace_cache);
zlib_workspace_cache = NULL;
}
#endif
25 changes: 8 additions & 17 deletions module/os/linux/spl/spl-kmem-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@ spl_magazine_destroy(spl_kmem_cache_t *skc)
* priv cache private data for ctor/dtor/reclaim
* vmp unused must be NULL
* flags
* KMC_VMEM Force SPL vmem backed cache
* KMC_KVMEM Force kvmem backed cache
* KMC_SLAB Force Linux slab backed cache
* KMC_OFFSLAB Locate objects off the slab
Expand Down Expand Up @@ -827,7 +826,7 @@ spl_kmem_cache_create(char *name, size_t size, size_t align,
* linuxslab) then select a cache type based on the object size
* and default tunables.
*/
if (!(skc->skc_flags & (KMC_VMEM | KMC_SLAB | KMC_KVMEM))) {
if (!(skc->skc_flags & (KMC_SLAB | KMC_KVMEM))) {
if (spl_kmem_cache_slab_limit &&
size <= (size_t)spl_kmem_cache_slab_limit) {
/*
Expand All @@ -847,7 +846,7 @@ spl_kmem_cache_create(char *name, size_t size, size_t align,
/*
* Given the type of slab allocate the required resources.
*/
if (skc->skc_flags & (KMC_VMEM | KMC_KVMEM)) {
if (skc->skc_flags & KMC_KVMEM) {
rc = spl_slab_size(skc,
&skc->skc_slab_objs, &skc->skc_slab_size);
if (rc)
Expand Down Expand Up @@ -926,7 +925,7 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc)
taskqid_t id;

ASSERT(skc->skc_magic == SKC_MAGIC);
ASSERT(skc->skc_flags & (KMC_VMEM | KMC_KVMEM | KMC_SLAB));
ASSERT(skc->skc_flags & (KMC_KVMEM | KMC_SLAB));

down_write(&spl_kmem_cache_sem);
list_del_init(&skc->skc_list);
Expand All @@ -948,7 +947,7 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc)
*/
wait_event(wq, atomic_read(&skc->skc_ref) == 0);

if (skc->skc_flags & (KMC_VMEM | KMC_KVMEM)) {
if (skc->skc_flags & KMC_KVMEM) {
spl_magazine_destroy(skc);
spl_slab_reclaim(skc);
} else {
Expand Down Expand Up @@ -1100,21 +1099,13 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags, void **obj)
}

/*
* To reduce the overhead of context switch and improve NUMA locality,
* it tries to allocate a new slab in the current process context with
* KM_NOSLEEP flag. If it fails, it will launch a new taskq to do the
* allocation.
* Note: It would be nice to reduce the overhead of context switch
* and improve NUMA locality, by trying to allocate a new slab in the
* current process context with KM_NOSLEEP flag.
*
* However, this can't be applied to KVM_VMEM due to a bug that
* However, this can't be applied to vmem/kvmem due to a bug that
* spl_vmalloc() doesn't honor gfp flags in page table allocation.
*/
if (!(skc->skc_flags & KMC_VMEM) && !(skc->skc_flags & KMC_KVMEM)) {
rc = __spl_cache_grow(skc, flags | KM_NOSLEEP);
if (rc == 0) {
wake_up_all(&skc->skc_waitq);
return (0);
}
}

/*
* This is handled by dispatching a work request to the global work
Expand Down
27 changes: 0 additions & 27 deletions module/os/linux/spl/spl-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,33 +631,6 @@ static struct ctl_table spl_kmem_table[] = {
.proc_handler = &proc_doulongvec_minmax,
},
#endif /* DEBUG_KMEM */
{
.procname = "slab_vmem_total",
.data = (void *)(KMC_VMEM | KMC_TOTAL),
.maxlen = sizeof (unsigned long),
.extra1 = &table_min,
.extra2 = &table_max,
.mode = 0444,
.proc_handler = &proc_doslab,
},
{
.procname = "slab_vmem_alloc",
.data = (void *)(KMC_VMEM | KMC_ALLOC),
.maxlen = sizeof (unsigned long),
.extra1 = &table_min,
.extra2 = &table_max,
.mode = 0444,
.proc_handler = &proc_doslab,
},
{
.procname = "slab_vmem_max",
.data = (void *)(KMC_VMEM | KMC_MAX),
.maxlen = sizeof (unsigned long),
.extra1 = &table_min,
.extra2 = &table_max,
.mode = 0444,
.proc_handler = &proc_doslab,
},
{
.procname = "slab_kvmem_total",
.data = (void *)(KMC_KVMEM | KMC_TOTAL),
Expand Down

0 comments on commit d83c271

Please sign in to comment.