linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Jens Axboe <axboe@kernel.dk>, Hugh Dickins <hughd@google.com>,
	Shaohua Li <shaohua.li@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
	x86@kernel.org
Subject: [PATCH block:for-3.3/core] block: disable ELEVATOR_INSERT_SORT_MERGE
Date: Thu, 5 Jan 2012 19:52:47 -0800	[thread overview]
Message-ID: <20120106035247.GF6276@google.com> (raw)
In-Reply-To: <20120106033012.GE6276@google.com>

5e84ea3a9c "block: attempt to merge with existing requests on plug
flush" added support for merging requests on plug flush and 274193224c
"block: recursive merge requests" added recursive merging.

Because these mergings happen before the request is inserted on the
elevator, the usual elv_latter/former_request() can't be used to
locate merge candidates.  It instead used bio merging mechanism -
last_merge hint and rqhash; unfortunately, this means that the
elevator doesn't have a say in which are allowed to merge and which
aren't.

For cfq, this resulted in merges across different cfqq's which led to
crashes as requests jump between different cfqq's unexpectedly.

Proper solution would be improving merge mechanism such that we can
always query elevator to find out merge candidates and remove rqhash;
however, the merge window is already upon us.  Disable
INSERT_SORT_MERGE for now.

For detailed discussion of the bug:

 http://thread.gmane.org/gmane.linux.kernel.next/20064/focus=20159

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Hugh Dickins <hughd@google.com>
Cc: stable@vger.kernel.org
---
 block/blk-core.c |    5 ++++-
 block/elevator.c |    5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 8fbdac7..7db6afa 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2859,11 +2859,14 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 
 		/*
 		 * rq is already accounted, so use raw insert
+		 *
+		 * FIXME: We want INSERT_SORT_MERGE for non-FLUSH/FUA
+		 * requests but it's currently broken.
 		 */
 		if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA))
 			__elv_add_request(q, rq, ELEVATOR_INSERT_FLUSH);
 		else
-			__elv_add_request(q, rq, ELEVATOR_INSERT_SORT_MERGE);
+			__elv_add_request(q, rq, ELEVATOR_INSERT_SORT);
 
 		depth++;
 	}
diff --git a/block/elevator.c b/block/elevator.c
index 99838f4..c32f5bc 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -644,6 +644,11 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where)
 
 	rq->q = q;
 
+	/*
+	 * FIXME: INSERT_SORT_MERGE is broken and blk_flush_plug_list(),
+	 * the only user, is updated to use INSERT_SORT for now.
+	 */
+
 	if (rq->cmd_flags & REQ_SOFTBARRIER) {
 		/* barriers are scheduling boundary, update end_sector */
 		if (rq->cmd_type == REQ_TYPE_FS ||

  reply	other threads:[~2012-01-06  3:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21  6:47 linux-next: Tree for Dec 21 Stephen Rothwell
2011-12-21 20:11 ` linux-next: Tree for Dec 21 (xen) Randy Dunlap
2011-12-21 19:30   ` Konrad Rzeszutek Wilk
2011-12-21 20:32 ` [PATCH] usb: fix renesas mod_gadget printk format warning Randy Dunlap
2011-12-21 21:16   ` Felipe Balbi
2011-12-21 22:19     ` Randy Dunlap
2011-12-21 21:24       ` Greg KH
2011-12-21 23:15 ` linux-next: Tree for Dec 21 Andrew Morton
2011-12-22 23:08   ` Andrew Morton
2011-12-22 23:20     ` Tejun Heo
2011-12-22 23:24       ` Andrew Morton
2011-12-22 23:38         ` Tejun Heo
2011-12-22 23:44           ` Andrew Morton
2011-12-22 23:46             ` Tejun Heo
2011-12-23  0:42               ` Tejun Heo
2011-12-24  5:13                 ` Hugh Dickins
2011-12-25  1:02                   ` [PATCH block/for-3.3/core] block: an exiting task should be allowed to create io_context Tejun Heo
2011-12-25 13:29                     ` Jens Axboe
2011-12-27 22:07                       ` Andrew Morton
2011-12-28  8:33                     ` Hugh Dickins
2011-12-28 16:48                       ` Tejun Heo
2011-12-28 17:50                         ` Hugh Dickins
2011-12-28 17:55                           ` Tejun Heo
2011-12-28 21:19                             ` Tejun Heo
2012-01-03 17:35                               ` Tejun Heo
2012-01-03 17:59                                 ` Tejun Heo
2012-01-03 20:09                                   ` Tejun Heo
2012-01-03 20:20                                     ` Jens Axboe
2012-01-03 22:13                                       ` Tejun Heo
2012-01-03 22:35                                         ` Tejun Heo
2012-01-05  1:24                                           ` Tejun Heo
2012-01-05 18:36                                             ` Hugh Dickins
2012-01-05 18:38                                               ` Tejun Heo
2012-01-06  2:17                                                 ` [PATCH block:for-3.3/core] cfq: merged request shouldn't jump to a different cfqq Tejun Heo
2012-01-06  2:36                                                   ` Tejun Heo
2012-01-06  3:14                                                     ` Shaohua Li
2012-01-06  3:04                                                       ` Tejun Heo
2012-01-06  3:30                                                         ` Tejun Heo
2012-01-06  3:52                                                           ` Tejun Heo [this message]
2012-01-06  4:19                                                             ` [PATCH block:for-3.3/core] block: disable ELEVATOR_INSERT_SORT_MERGE Shaohua Li
2012-01-06  4:38                                                               ` Tejun Heo
2012-01-06  8:15                                                                 ` Shaohua Li
2012-01-06 15:34                                                                   ` Tejun Heo
2012-01-06  3:34                                                         ` [PATCH block:for-3.3/core] cfq: merged request shouldn't jump to a different cfqq Shaohua Li
2012-01-06  3:22                                                           ` Tejun Heo
2012-01-06  4:15                                                             ` Shaohua Li
2012-01-06  4:40                                                               ` Tejun Heo
2012-01-06  2:47                                                   ` Shaohua Li
2011-12-25 16:08 ` linux-next: Tree for Dec 21 Sedat Dilek
2011-12-25 23:55   ` Stephen Rothwell

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=20120106035247.GF6276@google.com \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hughd@google.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=shaohua.li@intel.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).