Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762022AbcJ1Www (ORCPT ); Fri, 28 Oct 2016 18:52:52 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:42011 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756744AbcJ1Wwl (ORCPT ); Fri, 28 Oct 2016 18:52:41 -0400 From: Shaohua Li To: , CC: , Subject: [PATCH 1/2] block: immediately dispatch big size request Date: Fri, 28 Oct 2016 15:52:35 -0700 Message-ID: X-Mailer: git-send-email 2.9.3 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-28_12:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1743 Lines: 49 Currently block plug holds up to 16 non-mergeable requests. This makes sense if the request size is small, eg, reduce lock contention. But if request size is big enough, we don't need to worry about lock contention. Holding such request makes no sense and it lows the disk utilization. In practice, this improves 10% throughput for my raid5 sequential write workload. The size (128k) is arbitrary right now, but it makes sure lock contention is small. This probably could be more intelligent, eg, check average request size holded. Since this is mainly for sequential IO, probably not worthy. Signed-off-by: Shaohua Li --- block/blk-core.c | 4 +++- include/linux/blkdev.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 14d7c07..0a396e9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1763,7 +1763,9 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio) if (!request_count) trace_block_plug(q); else { - if (request_count >= BLK_MAX_REQUEST_COUNT) { + struct request *first = list_entry_rq(plug->list.next); + if (request_count >= BLK_MAX_REQUEST_COUNT || + blk_rq_bytes(first) >= BLK_PLUG_FLUSH_SIZE) { blk_flush_plug_list(plug, false); trace_block_plug(q); } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c47c358..72fa505 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1078,6 +1078,7 @@ struct blk_plug { struct list_head cb_list; /* md requires an unplug callback */ }; #define BLK_MAX_REQUEST_COUNT 16 +#define BLK_PLUG_FLUSH_SIZE (128 * 1024) struct blk_plug_cb; typedef void (*blk_plug_cb_fn)(struct blk_plug_cb *, bool); -- 2.9.3