summaryrefslogtreecommitdiff
path: root/slabs.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2012-07-15 21:03:12 -0700
committerdormando <dormando@rydia.net>2012-07-27 12:47:16 -0700
commit63bf748a10d1e55c67783a517d2d4d28d2a14303 (patch)
tree64ccce415fc3ae574298d5cb86b6c03a747dcdd0 /slabs.c
parentc2e0023d0235a055e6fe025f560cf388abfeab98 (diff)
downloadmemcached-63bf748a10d1e55c67783a517d2d4d28d2a14303.tar.gz
automove levels are an int instead of bool now
also fix a bug causing slab rebalance thread to spin instead of waiting on the condition... duhr.
Diffstat (limited to 'slabs.c')
-rw-r--r--slabs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/slabs.c b/slabs.c
index cf8dd0c..2503381 100644
--- a/slabs.c
+++ b/slabs.c
@@ -734,7 +734,7 @@ static void *slab_maintenance_thread(void *arg) {
int src, dest;
while (do_run_slab_thread) {
- if (settings.slab_automove) {
+ if (settings.slab_automove == 1) {
if (slab_automove_decision(&src, &dest) == 1) {
/* Blind to the return codes. It will retry on its own */
slabs_reassign(src, dest);
@@ -769,6 +769,13 @@ static void *slab_rebalance_thread(void *arg) {
if (slab_rebal.done) {
slab_rebalance_finish();
+ } else if (was_busy) {
+ /* Stuck waiting for some items to unlock, so slow down a bit
+ * to give them a chance to free up */
+ usleep(50);
+ }
+
+ if (slab_rebalance_signal == 0) {
/* Wrap the conditional with slabs_lock so we can't accidentally miss
* a signal */
/* FIXME: Technically there's a race between
@@ -777,10 +784,6 @@ static void *slab_rebalance_thread(void *arg) {
mutex_lock(&slabs_lock);
pthread_cond_wait(&slab_rebalance_cond, &slabs_lock);
pthread_mutex_unlock(&slabs_lock);
- } else if (was_busy) {
- /* Stuck waiting for some items to unlock, so slow down a bit
- * to give them a chance to free up */
- usleep(50);
}
}
return NULL;