lkml.org 
[lkml]   [2018]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 09/14] blk-mq: ensure that plug lists don't straddle hardware queues
From
Date
On Mon, 2018-10-29 at 10:37 -0600, Jens Axboe wrote:
> void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
> {
> struct blk_mq_ctx *this_ctx;
> @@ -1628,7 +1649,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
> struct request *rq;
> LIST_HEAD(list);
> LIST_HEAD(ctx_list);
> - unsigned int depth;
> + unsigned int depth, this_flags;
>
> list_splice_init(&plug->mq_list, &list);
>
> @@ -1636,13 +1657,14 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
>
> this_q = NULL;
> this_ctx = NULL;
> + this_flags = 0;
> depth = 0;
>
> while (!list_empty(&list)) {
> rq = list_entry_rq(list.next);
> list_del_init(&rq->queuelist);
> BUG_ON(!rq->q);
> - if (rq->mq_ctx != this_ctx) {
> + if (!ctx_match(rq, this_ctx, this_flags)) {
> if (this_ctx) {
> trace_block_unplug(this_q, depth, !from_schedule);
> blk_mq_sched_insert_requests(this_q, this_ctx,
> @@ -1650,6 +1672,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
> from_schedule);
> }
>
> + this_flags = rq->cmd_flags;
> this_ctx = rq->mq_ctx;
> this_q = rq->q;
> depth = 0;

This patch will cause the function stored in the flags_to_type pointer to be
called 2 * (n - 1) times where n is the number of elements in 'list' when
blk_mq_sched_insert_requests() is called. Have you considered to rearrange
the code such that that number of calls is reduced to n?

Thanks,

Bart.

\
 
 \ /
  Last update: 2018-10-29 20:28    [W:0.976 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site