diff options
Diffstat (limited to 'src/core/aio.c')
| -rw-r--r-- | src/core/aio.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/core/aio.c b/src/core/aio.c index 2d288a40..564e91a3 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -41,7 +41,7 @@ static int nni_aio_expire_q_cnt; // condition variable, and expiration thread. By default, this is one // per CPU core present -- the goal being to reduce overall pressure // caused by a single lock. The number of queues (and threads) can -// be tuned using the NNG_EXPIRE_THREADS tunable. +// be tuned using the NNG_NUM_EXPIRE_THREADS tunable. // // We will not permit an AIO // to be marked done if an expiration is outstanding. @@ -795,24 +795,16 @@ nni_aio_sys_init(void) { int num_thr; - // We create a thread per CPU core for expiration by default. +#ifndef NNG_NUM_EXPIRE_THREADS num_thr = nni_plat_ncpu(); -#ifndef NNG_EXPIRE_THREADS -#ifndef NNG_MAX_EXPIRE_THREADS -#define NNG_MAX_EXPIRE_THREADS 8 +#else + num_thr = NNG_NUM_EXPIRE_THREADS; #endif - if ((num_thr > NNG_MAX_EXPIRE_THREADS) && (NNG_MAX_EXPIRE_THREADS > 0)) { +#if NNG_MAX_EXPIRE_THREADS > 0 + if (num_thr > NNG_MAX_EXPIRE_THREADS) { num_thr = NNG_MAX_EXPIRE_THREADS; } -#else - num_thr = NNG_EXPIRE_THREADS; #endif - if (num_thr > 256) { // upper limits - num_thr = 256; - } - if (num_thr < 1) { - num_thr = 1; - } nni_aio_expire_q_list = nni_zalloc(sizeof(nni_aio_expire_q *) * num_thr); |
