mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: Jens Axboe <axboe@kernel.dk>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/2]block: avoid unnecessary plug list flush
Date: Wed, 28 Sep 2011 17:47:35 +0900	[thread overview]
Message-ID: <87y5x9cau0.fsf@gmail.com> (raw)
In-Reply-To: <1317179485.22361.10.camel@sli10-conroe> (Shaohua Li's message of "Wed, 28 Sep 2011 11:11:25 +0800")

Shaohua Li <shaohua.li@intel.com> writes:

> get_request_wait() could sleep and flush the plug list. If the list
> is already flushed, don't flush again.
>
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Reviewed-by: Namhyung Kim <namhyung@gmail.com>

Good catch! If get_request_wait() updated request_count after sleeping
we could live with the original code, but your change makes more sense IMHO.

Thanks.


>
> ---
>  block/blk-core.c |   16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> Index: linux/block/blk-core.c
> ===================================================================
> --- linux.orig/block/blk-core.c	2011-09-28 11:05:06.000000000 +0800
> +++ linux/block/blk-core.c	2011-09-28 11:05:22.000000000 +0800
> @@ -1299,15 +1299,17 @@ get_rq:
>  		 */
>  		if (list_empty(&plug->list))
>  			trace_block_plug(q);
> -		else if (!plug->should_sort) {
> -			struct request *__rq;
> +		else {
> +			if (!plug->should_sort) {
> +				struct request *__rq;
>  
> -			__rq = list_entry_rq(plug->list.prev);
> -			if (__rq->q != q)
> -				plug->should_sort = 1;
> +				__rq = list_entry_rq(plug->list.prev);
> +				if (__rq->q != q)
> +					plug->should_sort = 1;
> +			}
> +			if (request_count >= BLK_MAX_REQUEST_COUNT)
> +				blk_flush_plug_list(plug, false);
>  		}
> -		if (request_count >= BLK_MAX_REQUEST_COUNT)
> -			blk_flush_plug_list(plug, false);
>  		list_add_tail(&req->queuelist, &plug->list);
>  		drive_stat_acct(req, 1);
>  	} else {

      reply	other threads:[~2011-09-28  8:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-28  3:11 Shaohua Li
2011-09-28  8:47 ` Namhyung Kim [this message]

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=87y5x9cau0.fsf@gmail.com \
    --to=namhyung@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaohua.li@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome