Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1845717pxb; Fri, 24 Sep 2021 13:21:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr1FOnqQfCEZ22eBD7uzHMHO2XMkOb+mPsh3uQ6YbfHyCgbQlDXY7p5CHEGXByT9j12qAe X-Received: by 2002:a17:906:2cd6:: with SMTP id r22mr13107263ejr.398.1632514911994; Fri, 24 Sep 2021 13:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632514911; cv=none; d=google.com; s=arc-20160816; b=aFAqo9goW+SvLi06cHPwtW94Rjcu+3bJBRA55+EKBbEcfKxeJmU6HVuyO9ObcQrSw7 zUN4knaB4PPrsB8HBAwCmQAYT5DiInpUQtmoCe/BkJsD4s4o49EEpBxQzXC2wGzftUsM a6V6QTuHWCqFEWLNnjeixqejcIdt2pAE72/6kRScSFMj6NZIc50pAalLbH0DzncCSEF7 9AZJyYXk6sa4C+ljrPPLcd9yHj1iDbyjT+IlwFOW5tRnMX2F4vfC98sPKRnUlxnjBQrE 3mLhOVcEs7Xf2Mb56WBPOnmiFWthgB81yPlqSsN1C/nBBIEwGnzip3AmUHTAqvmcTpHF UYFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ok0/dZ0F2LLIovMeqe/aPH4YS8dOZgu/SQwFAkbdiMo=; b=WvxwHC0Vjj6/6v1ohKKJodT+NTdgXckSzUvhymJo32o9Fy5ZMrwLv/N1BlO9SI4ZYo MVLIg/ZpA/ZCZvLpo9MoA8bo5FEg+cCTrULyHJmmgQNyIZks9jq4spEW7o0cBNUCxHJn 62Rx2YXfYoTUPCWtDLWkxeRCbwIaahM7mrdGKrJY9E85EZpH6Y4woK88VqXOXrutCV3v QrABIqpGiIB/XdvJ29zePX22WUED11uUP4SLop/83Tpsfw0k9VVdgZbM6aUxO3mnqH+l FhZxABLGtRkHvak6R6aIwzRju5OC6voRY93E+dXRoI3xfohGHMrKksuNA5L/gDmGbkzN uEow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UeWOXVEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bh21si415100ejb.428.2021.09.24.13.21.27; Fri, 24 Sep 2021 13:21:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UeWOXVEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345736AbhIXNOa (ORCPT + 99 others); Fri, 24 Sep 2021 09:14:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:38152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346575AbhIXNLA (ORCPT ); Fri, 24 Sep 2021 09:11:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8D9886124D; Fri, 24 Sep 2021 12:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632488301; bh=b0/oDv20ftYzb0FTC6s+Eeyu7r6/ampOJ6XBdVGYDtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UeWOXVEE17j7Svrt8d6RkBbqF7QVTn0QL7UX/P71nAEMzxom21BVvaO3EFT+efmzZ Ls6MNSAq5e1jjTeHw9HZgZQP6IcpCqHNZPrmJsP4H2q74l7M91lTk1Q2GwMzVCoD92 yudugn2zJwgNBbw4OIAxj/ffGTycCsZS7CCWVQ/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcin Wanat , Song Liu , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 60/63] blk-mq: allow 4x BLK_MAX_REQUEST_COUNT at blk_plug for multiple_queues Date: Fri, 24 Sep 2021 14:45:00 +0200 Message-Id: <20210924124336.327864479@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210924124334.228235870@linuxfoundation.org> References: <20210924124334.228235870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Song Liu [ Upstream commit 7f2a6a69f7ced6db8220298e0497cf60482a9d4b ] Limiting number of request to BLK_MAX_REQUEST_COUNT at blk_plug hurts performance for large md arrays. [1] shows resync speed of md array drops for md array with more than 16 HDDs. Fix this by allowing more request at plug queue. The multiple_queue flag is used to only apply higher limit to multiple queue cases. [1] https://lore.kernel.org/linux-raid/CAFDAVznS71BXW8Jxv6k9dXc2iR3ysX3iZRBww_rzA8WifBFxGg@mail.gmail.com/ Tested-by: Marcin Wanat Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-mq.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 9e3fedbaa644..6dcb86c1c985 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2109,6 +2109,18 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq) } } +/* + * Allow 4x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple + * queues. This is important for md arrays to benefit from merging + * requests. + */ +static inline unsigned short blk_plug_max_rq_count(struct blk_plug *plug) +{ + if (plug->multiple_queues) + return BLK_MAX_REQUEST_COUNT * 4; + return BLK_MAX_REQUEST_COUNT; +} + /** * blk_mq_submit_bio - Create and send a request to block device. * @bio: Bio pointer. @@ -2202,7 +2214,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio) else last = list_entry_rq(plug->mq_list.prev); - if (request_count >= BLK_MAX_REQUEST_COUNT || (last && + if (request_count >= blk_plug_max_rq_count(plug) || (last && blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) { blk_flush_plug_list(plug, false); trace_block_plug(q); -- 2.33.0