From patchwork Fri Aug 27 12:01:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 503386 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1197727jab; Fri, 27 Aug 2021 05:07:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziXhrp3+m3CysVUtcdQFxtdZoBW4wDfQolZCvxPCmHDYALqItlCWTlpDUEfBUMc7dOS1Yb X-Received: by 2002:a17:906:498b:: with SMTP id p11mr9837297eju.295.1630066019972; Fri, 27 Aug 2021 05:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630066019; cv=none; d=google.com; s=arc-20160816; b=zAsMV1v5MOcI2HGuN8ODdNstGz8MswdNLbDE19a5GcCzq2nPla9+PSOq9TgIe2lw+I /KP1m/ZNWEDOQfqjD4VUbff/k7ZFCd9puyFXviym/R+gGg7JAnKo8OjnC7pPhTj7L7JA iQoyDScuKIpJBRoLB8EsPLpTX4739aRw8bkuoBySzyRzn0k32loqv0cnZQJhP52dMdGC CKUa2aWOjzGH7iKhyrR/gKT5Q+HTFcmdoz0pBoIxq8c2jWfcxe5Hg/8xT1vU0MHnADDW t5291A7kSBiXq6W2rv4Li/ySBPeHGWRkn6Lm+wt45h2/nsnRw7tE/hWm5vLLj4UY7I7e B0FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=LaJPyEoYvppOPmRO/c219w018NBOXc40hPgIefY/Org=; b=NrEek15Y2shG2hf5JtTGVY/djFziSlwuzVpxnWUQyo5uMYZjmVB/G8KUCA0+00IiHB ydDNHGdeL0qDXxGkHry4PLvoVncaS3lMIQ1+Y5C1CNAauYfHASV44a3g3IRvHJoqgbC9 ak7KjlzhLUEGrsc6Nkf4hgwB3o6nZLbA4UxUuPk+CtRnEIR9mnD1YqIWUD4pPJSLFkkk qIh55z8V8og4JZralZ0hX12hAVDs6sm7VQnOjvYVg2svemencpE3NmyBV8Ud5384Db8P 07pGxQkvGqeykK/wTQ1wcLYWQlf0S62Us4Z9C3mezO2z4QVl294VUbswIlOngzaqiK6y zzIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne32si5450103ejc.27.2021.08.27.05.06.59 for ; Fri, 27 Aug 2021 05:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245124AbhH0MHq (ORCPT ); Fri, 27 Aug 2021 08:07:46 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3698 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245111AbhH0MHp (ORCPT ); Fri, 27 Aug 2021 08:07:45 -0400 Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Gwz1j3qhbz67snn; Fri, 27 Aug 2021 20:05:29 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Fri, 27 Aug 2021 14:06:54 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Fri, 27 Aug 2021 13:06:52 +0100 From: John Garry To: CC: , , , , John Garry Subject: [PATCH v3 03/13] blk-mq: Relocate shared sbitmap resize in blk_mq_update_nr_requests() Date: Fri, 27 Aug 2021 20:01:54 +0800 Message-ID: <1630065724-69146-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1630065724-69146-1-git-send-email-john.garry@huawei.com> References: <1630065724-69146-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For shared sbitmap, if the call to blk_mq_tag_update_depth() was successful for any hctx when hctx->sched_tags is not set, then it would be successful for all (due to nature in which blk_mq_tag_update_depth() fails). As such, there is no need to call blk_mq_tag_resize_shared_sbitmap() for each hctx. So relocate the call until after the hctx iteration under the !q->elevator check, which is equivalent (to !hctx->sched_tags). Signed-off-by: John Garry Reviewed-by: Ming Lei --- block/blk-mq.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.26.2 diff --git a/block/blk-mq.c b/block/blk-mq.c index 7927e62d6395..2cc5b2952ceb 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3624,8 +3624,6 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) if (!hctx->sched_tags) { ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr, false); - if (!ret && blk_mq_is_sbitmap_shared(set->flags)) - blk_mq_tag_resize_shared_sbitmap(set, nr); } else { ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags, nr, true); @@ -3643,9 +3641,13 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) } if (!ret) { q->nr_requests = nr; - if (q->elevator && blk_mq_is_sbitmap_shared(set->flags)) - sbitmap_queue_resize(&q->sched_bitmap_tags, - nr - set->reserved_tags); + if (blk_mq_is_sbitmap_shared(set->flags)) { + if (q->elevator) + sbitmap_queue_resize(&q->sched_bitmap_tags, + nr - set->reserved_tags); + else + blk_mq_tag_resize_shared_sbitmap(set, nr); + } } blk_mq_unquiesce_queue(q);