From 2d836326ce8962a734ac099560256fe00e3b2c9c Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 18 Apr 2012 14:33:01 +0530 Subject: performance/io-threads: Change the thread scaling logic. Change-Id: Idc0db1cb2c26dcb0b36a58d4d43f2da10cde62c5 BUG: 812515 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/3186 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/performance/io-threads/src/io-threads.c | 13 +++++++------ xlators/performance/io-threads/src/io-threads.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index c2d660d4fa1..d316a19a463 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -59,6 +59,7 @@ __iot_dequeue (iot_conf_t *conf, int *pri) return NULL; conf->queue_size--; + conf->queue_sizes[*pri]--; list_del_init (&stub->list); return stub; @@ -74,6 +75,7 @@ __iot_enqueue (iot_conf_t *conf, call_stub_t *stub, int pri) list_add_tail (&stub->list, &conf->reqs[pri]); conf->queue_size++; + conf->queue_sizes[pri]++; return; } @@ -2359,20 +2361,19 @@ out: int __iot_workers_scale (iot_conf_t *conf) { - int log2 = 0; int scale = 0; int diff = 0; pthread_t thread; int ret = 0; + int i = 0; - log2 = log_base2 (conf->queue_size); + for (i = 0; i < IOT_PRI_MAX; i++) + scale += min (conf->queue_sizes[i], conf->ac_iot_limit[i]); - scale = log2; - - if (log2 < IOT_MIN_THREADS) + if (scale < IOT_MIN_THREADS) scale = IOT_MIN_THREADS; - if (log2 > conf->max_count) + if (scale > conf->max_count) scale = conf->max_count; if (conf->curr_count < scale) { diff --git a/xlators/performance/io-threads/src/io-threads.h b/xlators/performance/io-threads/src/io-threads.h index d09fec94d8e..48c9ff9304f 100644 --- a/xlators/performance/io-threads/src/io-threads.h +++ b/xlators/performance/io-threads/src/io-threads.h @@ -76,6 +76,7 @@ struct iot_conf { int32_t ac_iot_limit[IOT_PRI_MAX]; int32_t ac_iot_count[IOT_PRI_MAX]; + int queue_sizes[IOT_PRI_MAX]; int queue_size; pthread_attr_t w_attr; -- cgit