Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752247AbbKPUOz (ORCPT ); Mon, 16 Nov 2015 15:14:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40949 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbbKPUOw (ORCPT ); Mon, 16 Nov 2015 15:14:52 -0500 From: Jeff Moyer To: Jan Kara Cc: Jens Axboe , LKML Subject: Re: [PATCH] blk-flush: Queue through IO scheduler when flush not required References: <1447334752-31027-1-git-send-email-jack@suse.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Mon, 16 Nov 2015 15:14:51 -0500 In-Reply-To: <1447334752-31027-1-git-send-email-jack@suse.com> (Jan Kara's message of "Thu, 12 Nov 2015 14:25:52 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1984 Lines: 46 Jan Kara writes: > Currently blk_insert_flush() just adds flush request to q->queue_head > when flush is not required. That completely bypasses IO scheduler so > e.g. CFQ can be idling waiting for new request to arrive and will idle > through the whole window unnecessarily. Luckily this only happens in > rare cases as usually checks in generic_make_request_checks() clear > FLUSH and FUA flags early if they are not needed. Right. I think the only way we'd even enter that 'if' block was if the drive state changed (from WB cache to WT cache) between generic_make_request_checks and blk_insert_flush. > When no flushing is actually required, we can easily fix the problem by > properly queueing the request through the IO scheduler. Ideally IO > scheduler should be also made aware of requests queued via > blk_flush_queue_rq(). However inserting flush request through IO > scheduler can have unwanted side-effects since due to flush batching > delaying the flush request in IO scheduler will delay all flush requests > possibly coming from other processes. So we keep adding the request > directly to q->queue_head. Reviewed-by: Jeff Moyer > Signed-off-by: Jan Kara > --- > block/blk-flush.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/blk-flush.c b/block/blk-flush.c > index 9c423e53324a..c81d56ec308f 100644 > --- a/block/blk-flush.c > +++ b/block/blk-flush.c > @@ -422,7 +422,7 @@ void blk_insert_flush(struct request *rq) > if (q->mq_ops) { > blk_mq_insert_request(rq, false, false, true); > } else > - list_add_tail(&rq->queuelist, &q->queue_head); > + q->elevator->type->ops.elevator_add_req_fn(q, rq); > return; > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/