* [patch 1/2]block: avoid unnecessary plug list flush
@ 2011-09-28 3:11 Shaohua Li
2011-09-28 8:47 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2011-09-28 3:11 UTC (permalink / raw)
To: Jens Axboe; +Cc: lkml
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>
---
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 {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch 1/2]block: avoid unnecessary plug list flush
2011-09-28 3:11 [patch 1/2]block: avoid unnecessary plug list flush Shaohua Li
@ 2011-09-28 8:47 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2011-09-28 8:47 UTC (permalink / raw)
To: Shaohua Li; +Cc: Jens Axboe, lkml
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 {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-28 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-28 3:11 [patch 1/2]block: avoid unnecessary plug list flush Shaohua Li
2011-09-28 8:47 ` Namhyung Kim
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).