diff options
author | Shreyas Siravara <sshreyas@fb.com> | 2016-12-15 09:06:00 -0800 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-01-04 03:42:40 -0800 |
commit | 6e4cb07d0df06a8c168394880a18a0ba4034c06b (patch) | |
tree | 077d3b9c867a068567fa36ea5067c548e60a4c3d /libglusterfs | |
parent | 369fa575a1089b472c39a3843c56f694e1f7ad6f (diff) |
core: Disable the memory pooler in Gluster via a build flag
Summary:
Passing --disable-mempool to configure will disable the mempool.
Change-Id: I60d5f70d54de507fe9f4695d7589f7ae1ba4bb0f
BUG: 1405165
Signed-off-by: Shreyas Siravara <sshreyas@fb.com>
Reviewed-on: http://review.gluster.org/16148
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Anoop C S <anoopcs@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/mem-pool.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 88fbdf58319..b11e4c72e12 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -391,6 +391,7 @@ mem_pool_new_fn (unsigned long sizeof_type, return NULL; } +#if !defined(GF_DISABLE_MEMPOOL) LOCK_INIT (&mem_pool->lock); INIT_LIST_HEAD (&mem_pool->list); INIT_LIST_HEAD (&mem_pool->global_list); @@ -429,6 +430,7 @@ mem_pool_new_fn (unsigned long sizeof_type, UNLOCK (&ctx->lock); out: +#endif /* GF_DISABLE_MEMPOOL */ return mem_pool; } @@ -454,6 +456,10 @@ mem_get0 (struct mem_pool *mem_pool) void * mem_get (struct mem_pool *mem_pool) { +#ifdef GF_DISABLE_MEMPOOL + return GF_CALLOC (1, mem_pool->real_sizeof_type, + gf_common_mt_mem_pool); +#else struct list_head *list = NULL; void *ptr = NULL; int *in_use = NULL; @@ -525,9 +531,11 @@ fwd_addr_out: UNLOCK (&mem_pool->lock); return ptr; +#endif /* GF_DISABLE_MEMPOOL */ } +#if !defined(GF_DISABLE_MEMPOOL) static int __is_member (struct mem_pool *pool, void *ptr) { @@ -546,11 +554,16 @@ __is_member (struct mem_pool *pool, void *ptr) return 1; } +#endif void mem_put (void *ptr) { +#ifdef GF_DISABLE_MEMPOOL + GF_FREE (ptr); + return; +#else struct list_head *list = NULL; int *in_use = NULL; void *head = NULL; @@ -628,6 +641,7 @@ mem_put (void *ptr) } } UNLOCK (&pool->lock); +#endif /* GF_DISABLE_MEMPOOL */ } void @@ -640,12 +654,12 @@ mem_pool_destroy (struct mem_pool *pool) "max=%d total=%"PRIu64, pool->padded_sizeof_type, pool->max_alloc, pool->alloc_count); +#if !defined(GF_DISABLE_MEMPOOL) list_del (&pool->global_list); LOCK_DESTROY (&pool->lock); GF_FREE (pool->name); GF_FREE (pool->pool); +#endif GF_FREE (pool); - - return; } |