diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-07-11 22:15:56 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-07-12 00:21:06 +0000 |
commit | e50365f275ada4afcd5f25f2ac3328e341a79d71 (patch) | |
tree | 0e0d1b5ee52424ab2c0fa125b4f31fedbd83e2a4 /ioq.c | |
parent | f83d0466afc32542f3f4ff962105c817a1be2c96 (diff) | |
download | cmogstored-e50365f275ada4afcd5f25f2ac3328e341a79d71.tar.gz |
Users reducing or increasing thread counts should increase ioq capacity, otherwise there's no point in having more or less threads if they are synched to the ioq capacity.
Diffstat (limited to 'ioq.c')
-rw-r--r-- | ioq.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -90,6 +90,7 @@ void mog_ioq_next(struct mog_ioq *check_ioq) } else { /* mog_ioq_adjust was called and lowered our capacity */ mog_ioq_current->cur--; + ioq_set_contended(mog_ioq_current); } CHECK(int, 0, pthread_mutex_unlock(&mog_ioq_current->mtx)); @@ -121,6 +122,23 @@ bool mog_ioq_contended(void) return __sync_bool_compare_and_swap(&cur->contended, true, false); } +/* + * called by the main/notify thread if the user has ever set + * "server aio_threads = XX" via sidechannel. + */ +void mog_ioq_adjust(struct mog_ioq *ioq, unsigned value) +{ + assert(value > 0 && "mog_ioq_adjust value must be non-zero"); + CHECK(int, 0, pthread_mutex_lock(&ioq->mtx)); + ioq->max = value; + + /* capacity reduced, get some threads to yield themselves */ + if (ioq->cur > ioq->max) + ioq_set_contended(ioq); + + CHECK(int, 0, pthread_mutex_unlock(&ioq->mtx)); +} + void mog_ioq_destroy(struct mog_ioq *ioq) { CHECK(int, 0, pthread_mutex_destroy(&ioq->mtx)); |