From patchwork Wed Jun 14 00:25:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RWQgVHNhaSAo6JSh5a6X6LuSKQ==?= X-Patchwork-Id: 13279360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 864F6EB64D7 for ; Wed, 14 Jun 2023 00:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=bqPzGlhfcoCgtVEdXVwudT6H/F+CytFuk0kwlvzT9Ik=; b=iXyNZBT8E+gMk4 CUGhM//L+aJG4P7tEyAfeIQlfBHPT3/W91I1sI3pDG9wkqh1trVLfebMNDN4Qk6lc7aQIzepkZukF tPPpP8uKIwrJ+2SE0ONFOuKRRA5/FEB/crXakjew7nwcUUO0/CwREq60kF4HAD3iFkFqL8pzXqrdY NwkcOkkusV/YKEyszDvtZS+n9Nglqg7EU9ui8SeAf2TIytI1IyR4HmRyrEDkhs2qx6iAlOCYiRGqj wz7+hcvgtAikCcexc7QAMIiGkc8NXDg/iZxcnfbFn5nOWzMHIYnkpRKjmPAxDvGLltFaitrtmRuJG SPYyROhc2sMaWT3gsIwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9Een-009Yue-2T; Wed, 14 Jun 2023 00:46:41 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9Eef-009YsU-1b; Wed, 14 Jun 2023 00:46:39 +0000 X-UUID: e45f57500a4c11ee912e1518a6540028-20230613 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=2uy7+tbw1Y+OXG3TkTMsX7CtXTp/7125jL2NZJ+Idfc=; b=gQ9sGR3+KlNe79dhoLjaUuRNiFG75wC79fmSpvmB043BC5IRIT7QxjT/7gx/G9aKhpS/B/jOid5Lfzy4X3/C2bD9vPYkcCXzPSLAundwUw+ntfmP23K5n9HUUlM28VgsAz1q2tQ8eIf769FeOZZvdqzg3M0cfCdpUXwmnS/DfgY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.26,REQID:3886c218-8ae8-4ca6-9887-22235d160b1a,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:cb9a4e1,CLOUDID:76fe853e-7aa7-41f3-a6bd-0433bee822f3,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: e45f57500a4c11ee912e1518a6540028-20230613 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 646912453; Tue, 13 Jun 2023 17:46:26 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 14 Jun 2023 08:26:22 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 14 Jun 2023 08:26:22 +0800 From: Ed Tsai To: CC: , , , , , , , , , , , , , , , , Ed Tsai Subject: [PATCH v3] blk-mq: check on cpu id when there is only one ctx mapping Date: Wed, 14 Jun 2023 08:25:29 +0800 Message-ID: <20230614002529.6636-1-ed.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230613_174633_806399_9E4DCC28 X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org commit f168420c62e7 ("blk-mq: don't redirect completion for hctx withs only one ctx mapping") When nvme applies a 1:1 mapping of hctx and ctx, there will be no remote request. But for ufs, the submission and completion queues could be asymmetric. (e.g. Multiple SQs share one CQ) Therefore, 1:1 mapping of hctx and ctx won't complete request on the submission cpu. In this situation, this nr_ctx check could violate the QUEUE_FLAG_SAME_FORCE, as a result, check on cpu id when there is only one ctx mapping. Signed-off-by: Ed Tsai Signed-off-by: Po-Wen Kao Suggested-by: Keith Busch Reviewed-by: Christoph Hellwig --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 41f7e2b500bd..ecc30ebe9483 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1176,7 +1176,8 @@ bool blk_mq_complete_request_remote(struct request *rq) * or a polled request, always complete locally, * it's pointless to redirect the completion. */ - if (rq->mq_hctx->nr_ctx == 1 || + if ((rq->mq_hctx->nr_ctx == 1 && + rq->mq_ctx->cpu == raw_smp_processor_id()) || rq->cmd_flags & REQ_POLLED) return false;