From dee096647ddf5315fee3108532fcc7e4b984c076 Mon Sep 17 00:00:00 2001 From: Evgeniy Polyakov Date: Wed, 21 Nov 2012 02:06:03 +0400 Subject: [PATCH] Tune nonblocking pool growing policy --- library/pool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/pool.c b/library/pool.c index a09bbbd..fc26a94 100644 --- a/library/pool.c +++ b/library/pool.c @@ -188,6 +188,7 @@ static void dnet_schedule_io(struct dnet_node *n, struct dnet_io_req *r) int pool_has_blocked_sph = 0; struct dnet_io_req *tmp; struct sph *sph; + int edge_num = pool->num / 4 + 1; pthread_mutex_lock(&pool->lock); list_for_each_entry(tmp, &pool->list, req_entry) { @@ -221,8 +222,8 @@ static void dnet_schedule_io(struct dnet_node *n, struct dnet_io_req *r) pthread_mutex_unlock(&pool->lock); sph = (struct sph *)r->data; - if ((sph->flags & DNET_SPH_FLAGS_SRC_BLOCK) && pool_has_blocked_sph && (atomic_read(&pool->avail) == 0)) { - dnet_work_pool_grow(n, pool, pool->num/4+1, dnet_io_process); + if ((sph->flags & DNET_SPH_FLAGS_SRC_BLOCK) && pool_has_blocked_sph && (atomic_read(&pool->avail) < edge_num)) { + dnet_work_pool_grow(n, pool, edge_num, dnet_io_process); } } -- 2.11.4.GIT