From 472722768af68d8e5faf34a3ecfc7cbbd9767205 Mon Sep 17 00:00:00 2001 From: vmallika Date: Thu, 9 Jul 2015 15:41:50 +0530 Subject: [PATCH 221/234] quota/marker: use smaller stacksize in synctask for marker updation This is a backport of http://review.gluster.org/#/c/11499 Default stacksize that synctask uses is 2M. For marker we set it to 16k Also move market xlator close to io-threads to have smaller stack > Change-Id: I8730132a6365cc9e242a3564a1e615d94ef2c651 > BUG: 1207735 > Signed-off-by: vmallika Change-Id: I4e0b68cc94fe133846c69d4858598599c2f5c51c BUG: 1224177 Signed-off-by: vmallika Reviewed-on: https://code.engineering.redhat.com/gerrit/52660 Reviewed-by: Raghavendra Gowdappa Tested-by: Raghavendra Gowdappa --- libglusterfs/src/syncop.c | 26 ++++++++++++++----- libglusterfs/src/syncop.h | 10 +++++-- xlators/features/marker/src/marker-quota.c | 4 +- .../features/qemu-block/src/coroutine-synctask.c | 2 +- xlators/mgmt/glusterd/src/glusterd-volgen.c | 2 +- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 26a4737..db45674 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -443,8 +443,8 @@ synctask_setid (struct synctask *task, uid_t uid, gid_t gid) struct synctask * -synctask_create (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk, - call_frame_t *frame, void *opaque) +synctask_create (struct syncenv *env, size_t stacksize, synctask_fn_t fn, + synctask_cbk_t cbk, call_frame_t *frame, void *opaque) { struct synctask *newtask = NULL; xlator_t *this = THIS; @@ -500,13 +500,19 @@ synctask_create (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk, goto err; } - newtask->stack = CALLOC (1, env->stacksize); + if (stacksize <= 0) { + newtask->stack = CALLOC (1, env->stacksize); + newtask->ctx.uc_stack.ss_size = env->stacksize; + } else { + newtask->stack = CALLOC (1, stacksize); + newtask->ctx.uc_stack.ss_size = stacksize; + } + if (!newtask->stack) { goto err; } newtask->ctx.uc_stack.ss_sp = newtask->stack; - newtask->ctx.uc_stack.ss_size = env->stacksize; makecontext (&newtask->ctx, (void (*)(void)) synctask_wrap, 2, newtask); @@ -561,13 +567,13 @@ synctask_join (struct synctask *task) int -synctask_new (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk, - call_frame_t *frame, void *opaque) +synctask_new1 (struct syncenv *env, size_t stacksize, synctask_fn_t fn, + synctask_cbk_t cbk, call_frame_t *frame, void *opaque) { struct synctask *newtask = NULL; int ret = 0; - newtask = synctask_create (env, fn, cbk, frame, opaque); + newtask = synctask_create (env, stacksize, fn, cbk, frame, opaque); if (!newtask) return -1; @@ -577,6 +583,12 @@ synctask_new (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk, return ret; } +int +synctask_new (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk, + call_frame_t *frame, void *opaque) +{ + return synctask_new1 (env, 0, fn, cbk, frame, opaque); +} struct synctask * syncenv_task (struct syncproc *proc) diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index f41706a..ca25d98 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -264,9 +264,13 @@ struct syncenv * syncenv_new (size_t stacksize, int procmin, int procmax); void syncenv_destroy (struct syncenv *); void syncenv_scale (struct syncenv *env); -int synctask_new (struct syncenv *, synctask_fn_t, synctask_cbk_t, call_frame_t* frame, void *); -struct synctask *synctask_create (struct syncenv *, synctask_fn_t, - synctask_cbk_t, call_frame_t *, void *); +int synctask_new1 (struct syncenv *, size_t stacksize, synctask_fn_t, + synctask_cbk_t, call_frame_t *frame, void *); +int synctask_new (struct syncenv *, synctask_fn_t, synctask_cbk_t, + call_frame_t *frame, void *); +struct synctask *synctask_create (struct syncenv *, size_t stacksize, + synctask_fn_t, synctask_cbk_t, call_frame_t *, + void *); int synctask_join (struct synctask *task); void synctask_wake (struct synctask *task); void synctask_yield (struct synctask *task); diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index 400e9ae..18e6405 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -2825,8 +2825,8 @@ mq_synctask (xlator_t *this, synctask_fn_t task, gf_boolean_t spawn, loc_t *loc, args->contri = contri; if (spawn) { - ret = synctask_new (this->ctx->env, task, mq_synctask_cleanup, - NULL, args); + ret = synctask_new1 (this->ctx->env, 1024 * 16, task, + mq_synctask_cleanup, NULL, args); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Failed to spawn " "new synctask"); diff --git a/xlators/features/qemu-block/src/coroutine-synctask.c b/xlators/features/qemu-block/src/coroutine-synctask.c index e43988a..5b7ca0c 100644 --- a/xlators/features/qemu-block/src/coroutine-synctask.c +++ b/xlators/features/qemu-block/src/coroutine-synctask.c @@ -105,7 +105,7 @@ qb_coroutine (call_frame_t *frame, synctask_fn_t fn) LOCK(&qb_co.lock); if (!qb_co.task) - qb_co.task = synctask_create(qb_conf->env, qb_synctask_wrap, + qb_co.task = synctask_create(qb_conf->env, 0, qb_synctask_wrap, synctask_nop_cbk, frame, NULL); list_add_tail(&qb_local->list, &qb_co.queue); diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index c3ec10b..ee5cf68 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -2234,9 +2234,9 @@ static volgen_brick_xlator_t server_graph_table[] = { {brick_graph_add_ro, NULL}, {brick_graph_add_worm, NULL}, {brick_graph_add_quota, "quota"}, - {brick_graph_add_marker, "marker"}, {brick_graph_add_index, "index"}, {brick_graph_add_barrier, NULL}, + {brick_graph_add_marker, "marker"}, {brick_graph_add_iot, "io-threads"}, {brick_graph_add_upcall, "upcall"}, {brick_graph_add_pump, NULL}, -- 1.7.1