From: Matthew Dillon Date: Tue, 3 Jul 2012 17:42:03 +0000 (-0700) Subject: kernel - reduce kernel stack use (2) X-Git-Tag: v3.2.0~697 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/4cda7147e5c08aeaba39cefffe91d62772a9dac7 kernel - reduce kernel stack use (2) * Correct hanging allocation on kldunload from previous commit. * Rearrange the flow of the code a little for the exit case. --- diff --git a/sys/kern/dsched/fq/fq_core.c b/sys/kern/dsched/fq/fq_core.c index 694150000a..195d7a28fe 100644 --- a/sys/kern/dsched/fq/fq_core.c +++ b/sys/kern/dsched/fq/fq_core.c @@ -100,16 +100,8 @@ fq_dispatcher(struct fq_disk_ctx *diskctx) * supposed to die away nicely or that the disk is idle. */ - if (__predict_false(diskctx->die == 1)) { - /* If we are supposed to die, drain all queues */ - fq_drain(diskctx, FQ_DRAIN_FLUSH); - - /* Now we can safely unlock and exit */ - DSCHED_DISK_CTX_UNLOCK(&diskctx->head); - kprintf("fq_dispatcher is peacefully dying\n"); - lwkt_exit(); - /* NOTREACHED */ - } + if (__predict_false(diskctx->die == 1)) + break; /* * We have been awakened because the disk is idle. @@ -193,6 +185,18 @@ fq_dispatcher(struct fq_disk_ctx *diskctx) DSCHED_DISK_CTX_LOCK(&diskctx->head); dsched_disk_ctx_unref(&diskctx->head); } + + /* + * If we are supposed to die, drain all queues, then + * unlock and exit. + */ + fq_drain(diskctx, FQ_DRAIN_FLUSH); + DSCHED_DISK_CTX_UNLOCK(&diskctx->head); + kfree(dispatch_ary, M_TEMP); + + kprintf("fq_dispatcher is peacefully dying\n"); + lwkt_exit(); + /* NOTREACHED */ } void