Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp751592pxb; Fri, 13 Aug 2021 05:42:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykiAc2UWBJ8BU6muCV2LIINec1O3dVDuWG0CBVeb4qFAwtG1jNoPIbIDN4Yy+FtD7pGxz0 X-Received: by 2002:a05:6402:1a23:: with SMTP id be3mr2832838edb.23.1628858527200; Fri, 13 Aug 2021 05:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628858527; cv=none; d=google.com; s=arc-20160816; b=Xmbh+RGZE+zLPHj3+Dswh5SQe4mnwO/4XeP/EHqtCZFbyzZ6KIomWSw2zMu4zdty3K M0r6GErht6R/DQbj3p1zpkYBgciq3vKiKHoFjrSTmjs9Bhip0i5B8wRb+JMz5xTotuTT yjzxkbY7g4rY/nKBNMH6zeSmveDHN4kmLnjS+a5bC0IR6L5DAaLfV31SxYjGC9BuQjTR ru2Vlp6cWriLtqQJECyKqayYpIaEzDdOYGq0hhk0of9nUgrO931p7CKILYkqnXjV03OE ZYSU4rV9syq1FMuyZcHwN4tekepnzLghLVBzkIDHLAlkNdVwLusbIUTbNH+MQHHouM7u K/NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=ElUKmzXcd2uG3rGA6c6VL1oKG/c5rq6bDuoGobDOJKY=; b=kdgmsti513GKAJq977K2g+ZA8rpaW6U+VBz5x8PL2r71gyKuZHQZ/mIn7DfrIrem17 ka9JAln9e+ebki4begy/K2xi/aVJlQj44n3sPwt12XOrs+LR3fRK0k+AB0YhJWnKpJ01 KeUQ5aLNPamEhykMoGeybwYoQuOpIfMcIvm26RuWLPzlFqaGP4FPAr/5FsNYb2vobZIM 95OWrkx6XOflJHm/xtNZkd+HJVO+398HP9HyeY4bOoUoVo3dXZWzCc/Ej2cGnHyU5peT YeO6Ni8LswoDVb0iZzaLEGi8cLTiPXaOEGZX4Hq++zV/sUiUnA+n6bBRP02wqhTJAGTC UWsQ== ARC-Authentication-Results: i=1; mx.google.com; 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=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 18si1522714ejy.624.2021.08.13.05.41.37; Fri, 13 Aug 2021 05:42:07 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240444AbhHMMhg (ORCPT + 99 others); Fri, 13 Aug 2021 08:37:36 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:17017 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240408AbhHMMh2 (ORCPT ); Fri, 13 Aug 2021 08:37:28 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GmNJ04zgxzb16Q; Fri, 13 Aug 2021 20:33:04 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 13 Aug 2021 20:36:45 +0800 Received: from [10.174.176.73] (10.174.176.73) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 13 Aug 2021 20:36:44 +0800 Subject: Re: [PATCH] blk-mq: clear active_queues before clearing BLK_MQ_F_TAG_QUEUE_SHARED To: Ming Lei CC: , , , References: <20210731062130.1533893-1-yukuai3@huawei.com> From: "yukuai (C)" Message-ID: <0f8e7e8c-9c4d-7b88-a967-c54cbbe038c8@huawei.com> Date: Fri, 13 Aug 2021 20:36:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, jens Can you please consider to apply this patch. By the way, sorry about the wrong email I replied. Thanks Kuai On 2021/08/06 10:25, Ming Lei wrote: > On Sat, Jul 31, 2021 at 02:21:30PM +0800, Yu Kuai wrote: >> We run a test that delete and recover devcies frequently(two devices on >> the same host), and we found that 'active_queues' is super big after a >> period of time. >> >> If device a and device b share a tag set, and a is deleted, then >> blk_mq_exit_queue() will clear BLK_MQ_F_TAG_QUEUE_SHARED because there >> is only one queue that are using the tag set. However, if b is still >> active, the active_queues of b might never be cleared even if b is >> deleted. >> >> Thus clear active_queues before BLK_MQ_F_TAG_QUEUE_SHARED is cleared. >> >> Signed-off-by: Yu Kuai >> --- >> block/blk-mq.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/block/blk-mq.c b/block/blk-mq.c >> index 2c4ac51e54eb..2fe396385a4a 100644 >> --- a/block/blk-mq.c >> +++ b/block/blk-mq.c >> @@ -2994,10 +2994,12 @@ static void queue_set_hctx_shared(struct request_queue *q, bool shared) >> int i; >> >> queue_for_each_hw_ctx(q, hctx, i) { >> - if (shared) >> + if (shared) { >> hctx->flags |= BLK_MQ_F_TAG_QUEUE_SHARED; >> - else >> + } else { >> + blk_mq_tag_idle(hctx); >> hctx->flags &= ~BLK_MQ_F_TAG_QUEUE_SHARED; >> + } >> } >> } > > Looks correct, the only remained queue in tagset has to be idled before > clearing BLK_MQ_F_TAG_QUEUE_SHARED: > > Reviewed-by: Ming Lei > > > > Thanks, > Ming > > . >