Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp72394imu; Thu, 6 Dec 2018 19:33:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/WS3j+fidrCUQ5UxXj0lvAkTHqcu8x3aaEa/SGHTwLS72ar3cs9RSZUBSveGaL7vlbQ2UDJ X-Received: by 2002:a63:cf56:: with SMTP id b22mr526519pgj.336.1544153598706; Thu, 06 Dec 2018 19:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544153598; cv=none; d=google.com; s=arc-20160816; b=DahcChvaruM3RkKd61WzvEzkX6nGGEFfVJ0sdPjxdqKgy5nTjgAMIHARnjyhhW0mer dLK8TQ+425Y1aUXWH9XMJvLIAPFSS5JifCyjckALxbTa24u0cs6HS47mbTMS+BTrCTk3 B7QCqJQ0bNNXxl2azRvTC4Zr4ZCEFLlPmAJhs4kF0rHg7fxUllCnGbtIp7Xr8Ju5RJFn J1uDwqSrqUUNB7QBMNVCXZzMxg/2ltmK3MUOQJk76SfUEik6jVuPi0/y+aw4iIe7c5Kj wn5TNY+G3+7OG1gBBEI6ExyaFFlxrciewqKDvjEdCPnyO4Nqj4XkXk8H1GH6kYiTE2Q3 AzTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=eDbrGrtMGzX23Lhnt+kuraVrwrm8L9n7EjAQYnzC2Vg=; b=GJ71LDzHjURikt5aP97OpTQVrqSDu0mZOVyNnMdCe0MCLN3KmGC+x1QnizTvqQtmXv 2ekX+X40IsdEYcVkY7Xs8o6MXRlGzkf5EDicY1Ux1oQCip/elmR+XESE6+wqTzlhS0mi qD7fEcly3AGir/jUIiFyGamtMREVBg6Mwm88jJR3/EadMeiAGB+m7UX6jJ8wfP8SX4ru PvZhYpOTT/5hSZ7OKnfC1Nq83KX1AOpfirXBD5F2wbnGjFrO0IU+7dQxBFP9vg+JFOot yBDZPmpRZqjQHKKGvrQO/F2aYhqtd6SI0wUR/NokBmi4mIAMVQjuWbTa93if38CqUDVk ff7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=mvxEd1wF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si1800378pgh.565.2018.12.06.19.33.02; Thu, 06 Dec 2018 19:33:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=mvxEd1wF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726044AbeLGDcL (ORCPT + 99 others); Thu, 6 Dec 2018 22:32:11 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38221 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbeLGDcK (ORCPT ); Thu, 6 Dec 2018 22:32:10 -0500 Received: by mail-pg1-f193.google.com with SMTP id g189so1083715pgc.5 for ; Thu, 06 Dec 2018 19:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eDbrGrtMGzX23Lhnt+kuraVrwrm8L9n7EjAQYnzC2Vg=; b=mvxEd1wFLzkEQx9EPRWesV7bwgvNGz/eVYsNYyA3C0hDZNzd/I3PZ+msHX6WTeLx7a S2rYwZJkkPSMY70rJahBZTiJ2kpHPlezva5hORcX6qmlLb3WaYYpqUeS18Oe3LKUnTLJ dAraXijmNsFNRvJwa81KWwo6MvGR2fY71R4LIZ8w0lLbaa1YPZwIWCEW14bdRIL91i+S kNIMu1ILYrf3APV56KX/6KoEKyu5GqJXU7mmxIH+zp5LDZ/xUJmJn9rGk8YXa/l0jYxZ qyiVaKl9yGDJNKKew/Yq8hWvfRVHpfs4BBORXPNSHIsxnkaZbCmWEPsbJFdtLnprLkPn HXog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eDbrGrtMGzX23Lhnt+kuraVrwrm8L9n7EjAQYnzC2Vg=; b=BoAZG9Dtw+1uFxBJRgPtYpGmg6z3URBgZC9Bk4ug+Uwmes1U3KsR9MNQyTmns1H/Jd yi2s9hevDz1CehZxy/5+lv0wB1VCjuy/zQCA8Do4mG9FuS19cantySJHKo7uljfPirR+ ZtDsUrx7D/SQx66gnliUEEWVkumO01QFkI3ulm5auP/CQP0Ne2BS9pP12rfscEpOqRj3 JL6Q7ivWvIz0qr2fY9f7ktce4pNIojONEXNq77Y1945eukZ1S9IrONB6IxteoD99pTp0 TzbB7upT8+mqv2bicZ4xBktMv/3KpRfoqSL8OXXcWi77b5GBmNs79leJ0AoBQdj9CsF8 X9gA== X-Gm-Message-State: AA+aEWZThuB1jpngIddATYJqyu3EZ6+KyVA15h7JhU0Ch1GVfohgTM/R RqY+ookjB3TLufxHiKL19zwKSeoN8+Y= X-Received: by 2002:a62:3241:: with SMTP id y62mr647391pfy.178.1544153529257; Thu, 06 Dec 2018 19:32:09 -0800 (PST) Received: from [192.168.1.121] (66.29.188.166.static.utbb.net. [66.29.188.166]) by smtp.gmail.com with ESMTPSA id i193sm2041671pgc.22.2018.12.06.19.32.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 19:32:07 -0800 (PST) Subject: Re: [PATCH V11 0/4] blk-mq: refactor code of issue directly To: "jianchao.wang" Cc: ming.lei@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <1544152185-32667-1-git-send-email-jianchao.w.wang@oracle.com> <0adf3419-bcce-93d8-51fb-aee7cbb5ae17@oracle.com> From: Jens Axboe Message-ID: <16205e68-aa5e-c59d-364e-4164a0e51dc7@kernel.dk> Date: Thu, 6 Dec 2018 20:32:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <0adf3419-bcce-93d8-51fb-aee7cbb5ae17@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/6/18 8:26 PM, jianchao.wang wrote: > > > On 12/7/18 11:16 AM, Jens Axboe wrote: >> On 12/6/18 8:09 PM, Jianchao Wang wrote: >>> Hi Jens >>> >>> Please consider this patchset for 4.21. >>> >>> It refactors the code of issue request directly to unify the interface >>> and make the code clearer and more readable. >>> >>> This patch set is rebased on the recent for-4.21/block and add the 1st >>> patch which inserts the non-read-write request to hctx dispatch >>> list to avoid to involve merge and io scheduler when bypass_insert >>> is true, otherwise, inserting is ignored, BLK_STS_RESOURCE is returned >>> and the caller will fail forever. >>> >>> The 2nd patch refactors the code of issue request directly to unify the >>> helper interface which could handle all the cases. >>> >>> The 3rd patch make blk_mq_sched_insert_requests issue requests directly >>> with 'bypass' false, then it needn't to handle the non-issued requests >>> any more. >>> >>> The 4th patch replace and kill the blk_mq_request_issue_directly. >> >> Sorry to keep iterating on this, but let's default to inserting to >> the dispatch list if we ever see busy from a direct dispatch. I'm fine >> with doing that for 4.21, as suggested by Ming, I just didn't want to >> fiddle with it for 4.20. This will prevent any merging on the request >> going forward, which I think is a much safer default. >> >> You do this already for some cases. Let's do it unconditionally for >> a request that was ever subjected to ->queue_rq() and we didn't either >> error or finish after the fact. >> > I have done it in this version if I get your point correctly. > Please refer to the following fragment in the 2nd patch. > > + /* > + * If the request is issued unsuccessfully with > + * BLK_STS_DEV_RESOURCE or BLK_STS_RESOURCE, insert > + * the request to hctx dispatch list due to attached > + * lldd resource. > + */ > + force = true; > + ret = __blk_mq_issue_directly(hctx, rq, cookie, last); > +out_unlock: > + hctx_unlock(hctx, srcu_idx); > +out: > + switch (ret) { > + case BLK_STS_OK: > + break; > + case BLK_STS_DEV_RESOURCE: > + case BLK_STS_RESOURCE: > + if (force) { > + blk_mq_request_bypass_insert(rq, run_queue); > + ret = bypass ? BLK_STS_OK : ret; > + } else if (!bypass) { > + blk_mq_sched_insert_request(rq, false, > + run_queue, false); > + } > + break; > + default: You are right, I missed that you set force = true before doing the issue. So this looks good to me! -- Jens Axboe