summaryrefslogtreecommitdiff
path: root/slabs.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2017-12-06 19:47:00 -0800
committerdormando <dormando@rydia.net>2017-12-07 15:28:13 -0800
commit48b07bd3200a92a82b7500b10f14843204502060 (patch)
tree65e1619e4374de044ffc226119a108df4068e1e4 /slabs.c
parentbb1080bb9f8ab5271699bb84eb90de1fcf9ed695 (diff)
downloadmemcached-48b07bd3200a92a82b7500b10f14843204502060.tar.gz
extstore: C version of automove algorithm
couple TODO items left for a new issue I thought of. Also hardcoded memory buffer size which should be fixed. also need to change the "free and re-init" logic to use a boolean in case any related option changes.
Diffstat (limited to 'slabs.c')
-rw-r--r--slabs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/slabs.c b/slabs.c
index 39cfbd2..c9a37aa 100644
--- a/slabs.c
+++ b/slabs.c
@@ -404,10 +404,24 @@ void fill_slab_stats_automove(slab_stats_automove *am) {
cur->chunks_per_page = p->perslab;
cur->free_chunks = p->sl_curr;
cur->total_pages = p->slabs;
+ cur->chunk_size = p->size;
}
pthread_mutex_unlock(&slabs_lock);
}
+/* TODO: slabs_available_chunks should grow up to encompass this.
+ * mem_flag is redundant with the other function.
+ */
+unsigned int global_page_pool_size(bool *mem_flag) {
+ unsigned int ret = 0;
+ pthread_mutex_lock(&slabs_lock);
+ if (mem_flag != NULL)
+ *mem_flag = mem_malloced >= mem_limit ? true : false;
+ ret = slabclass[SLAB_GLOBAL_PAGE_POOL].slabs;
+ pthread_mutex_unlock(&slabs_lock);
+ return ret;
+}
+
static int nz_strcmp(int nzlength, const char *nz, const char *z) {
int zlength=strlen(z);
return (zlength == nzlength) && (strncmp(nz, z, zlength) == 0) ? 0 : -1;