From 4cda7147e5c08aeaba39cefffe91d62772a9dac7 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 3 Jul 2012 10:42:03 -0700 Subject: [PATCH] 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. --- sys/kern/dsched/fq/fq_core.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) 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 -- 2.41.0