From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@fb.com>
Cc: linux-block@vger.kernel.org, osandov@fb.com, hch@lst.de,
bart.vanassche@sandisk.com
Subject: Re: [PATCH 1/3] blk-mq: unify hctx delayed_run_work and run_work
Date: Fri, 28 Apr 2017 10:12:31 +0800 [thread overview]
Message-ID: <20170428021230.GB31518@ming.t460p> (raw)
In-Reply-To: <1491839696-24783-2-git-send-email-axboe@fb.com>
On Mon, Apr 10, 2017 at 09:54:54AM -0600, Jens Axboe wrote:
> They serve the exact same purpose. Get rid of the non-delayed
> work variant, and just run it without delay for the normal case.
>
> Signed-off-by: Jens Axboe <axboe@fb.com>
> ---
> block/blk-core.c | 2 +-
> block/blk-mq.c | 27 ++++++---------------------
> include/linux/blk-mq.h | 3 +--
> 3 files changed, 8 insertions(+), 24 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 8654aa0cef6d..d58541e4dc7b 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -269,7 +269,7 @@ void blk_sync_queue(struct request_queue *q)
> int i;
>
> queue_for_each_hw_ctx(q, hctx, i) {
> - cancel_work_sync(&hctx->run_work);
> + cancel_delayed_work_sync(&hctx->run_work);
> cancel_delayed_work_sync(&hctx->delay_work);
> }
> } else {
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index e2ef7b460924..7afba6ab5a96 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1168,13 +1168,9 @@ static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async,
> put_cpu();
> }
>
> - if (msecs == 0)
> - kblockd_schedule_work_on(blk_mq_hctx_next_cpu(hctx),
> - &hctx->run_work);
> - else
> - kblockd_schedule_delayed_work_on(blk_mq_hctx_next_cpu(hctx),
> - &hctx->delayed_run_work,
> - msecs_to_jiffies(msecs));
> + kblockd_schedule_delayed_work_on(blk_mq_hctx_next_cpu(hctx),
> + &hctx->run_work,
> + msecs_to_jiffies(msecs));
> }
>
> void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs)
> @@ -1226,7 +1222,7 @@ EXPORT_SYMBOL(blk_mq_queue_stopped);
>
> void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx)
> {
> - cancel_work(&hctx->run_work);
> + cancel_delayed_work(&hctx->run_work);
> cancel_delayed_work(&hctx->delay_work);
> set_bit(BLK_MQ_S_STOPPED, &hctx->state);
> }
> @@ -1284,17 +1280,7 @@ static void blk_mq_run_work_fn(struct work_struct *work)
> {
> struct blk_mq_hw_ctx *hctx;
>
> - hctx = container_of(work, struct blk_mq_hw_ctx, run_work);
> -
> - __blk_mq_run_hw_queue(hctx);
> -}
> -
> -static void blk_mq_delayed_run_work_fn(struct work_struct *work)
> -{
> - struct blk_mq_hw_ctx *hctx;
> -
> - hctx = container_of(work, struct blk_mq_hw_ctx, delayed_run_work.work);
> -
> + hctx = container_of(work, struct blk_mq_hw_ctx, run_work.work);
> __blk_mq_run_hw_queue(hctx);
> }
>
> @@ -1899,8 +1885,7 @@ static int blk_mq_init_hctx(struct request_queue *q,
> if (node == NUMA_NO_NODE)
> node = hctx->numa_node = set->numa_node;
>
> - INIT_WORK(&hctx->run_work, blk_mq_run_work_fn);
> - INIT_DELAYED_WORK(&hctx->delayed_run_work, blk_mq_delayed_run_work_fn);
> + INIT_DELAYED_WORK(&hctx->run_work, blk_mq_run_work_fn);
> INIT_DELAYED_WORK(&hctx->delay_work, blk_mq_delay_work_fn);
> spin_lock_init(&hctx->lock);
> INIT_LIST_HEAD(&hctx->dispatch);
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index d75de612845d..2b4573a9ccf4 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -15,7 +15,7 @@ struct blk_mq_hw_ctx {
> unsigned long state; /* BLK_MQ_S_* flags */
> } ____cacheline_aligned_in_smp;
>
> - struct work_struct run_work;
> + struct delayed_work run_work;
> cpumask_var_t cpumask;
> int next_cpu;
> int next_cpu_batch;
> @@ -51,7 +51,6 @@ struct blk_mq_hw_ctx {
>
> atomic_t nr_active;
>
> - struct delayed_work delayed_run_work;
> struct delayed_work delay_work;
>
> struct hlist_node cpuhp_dead;
> --
> 2.7.4
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
next prev parent reply other threads:[~2017-04-28 2:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-10 15:54 [PATCH 0/3] blk-mq: unify hardware queue run handlers Jens Axboe
2017-04-10 15:54 ` [PATCH 1/3] blk-mq: unify hctx delayed_run_work and run_work Jens Axboe
2017-04-10 16:09 ` Christoph Hellwig
2017-04-10 16:17 ` Bart Van Assche
2017-04-11 18:00 ` Bart Van Assche
2017-04-14 20:02 ` Jens Axboe
2017-04-14 20:56 ` Bart Van Assche
2017-04-28 2:12 ` Ming Lei [this message]
2017-04-10 15:54 ` [PATCH 2/3] block: add kblock_mod_delayed_work_on() Jens Axboe
2017-04-10 16:10 ` Christoph Hellwig
2017-04-10 16:17 ` Bart Van Assche
2017-04-10 15:54 ` [PATCH 3/3] blk-mq: unify hctx delay_work and run_work Jens Axboe
2017-04-10 16:21 ` Bart Van Assche
2017-04-10 16:53 ` Jens Axboe
2017-04-10 17:23 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170428021230.GB31518@ming.t460p \
--to=ming.lei@redhat.com \
--cc=axboe@fb.com \
--cc=bart.vanassche@sandisk.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=osandov@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.