diff options
author | dormando <dormando@rydia.net> | 2017-12-06 19:47:00 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2017-12-07 15:28:13 -0800 |
commit | 48b07bd3200a92a82b7500b10f14843204502060 (patch) | |
tree | 65e1619e4374de044ffc226119a108df4068e1e4 /slabs.c | |
parent | bb1080bb9f8ab5271699bb84eb90de1fcf9ed695 (diff) | |
download | memcached-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.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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; |