Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30841788rwd; Thu, 6 Jul 2023 11:28:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrIey0jP6Wp4OVx3BBQPZ6XJI7Blb+zlH7mD4qCUChgU8caInL773THKPc40YenJBciE+f X-Received: by 2002:a17:90a:f40a:b0:263:f674:490e with SMTP id ch10-20020a17090af40a00b00263f674490emr7704911pjb.3.1688668083251; Thu, 06 Jul 2023 11:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688668083; cv=none; d=google.com; s=arc-20160816; b=jT30sgiVBUxezgBnxiNkNrMweMXdXQmMf4zZ+mUkuMVIInJAE7NUDQibvKhP/S+OLw 78EsK/L+iBW/0IELSZ/EzalPTdFfv1sw/w3wdTmfggaVk1VXQY1TnOEN1KIG3iOq6i/e oIDQhl469zX4V7ALK8MaWsP8tEKPu6hfPjvVVBvNjfSMKG9Va6xfucfkPZ+LLUDjg8yR bTqv/icJlCBVjb7b4FrNbt1xITqglV9f+o2NpPAoMqPipRP2N0f04ZxXZpvABUl5NqT1 h2NODfzqbLd7nfVAQ7LcpzY3sDRj90doqvyCdA5b+avS+nRhw2qLKrDJN1lwVM0bMign 3yiA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=O+ohPa783boQSqewlPh3vxCWnQt7IOYSt994tq4NfmU=; fh=/ecaBeglSeS6gi9IYGC6UaztYyZsF6/9G2JK0Q/If64=; b=prT01bjAlihhG0IQaKIrA8lUR7fJ25raA4aqsUmGfvbzKbGmNyeyLg1m2KGS5kKZlq z/dcwk3FbsmsydFWy7m1wBR0RzrpYHFsmL+xVg6YIeYVkf7OH28ecgr4obTQtGhOh/ZC 6FtZZaSfUacWPBvhOkqcMGZXweAIwW4nRERJikTYkaEHYr80uPZHFYKXyzGf5QvAGEHq xlawzb7Y0nhMA5id1aDWE5l8z1jCin67FWKhuM1FoC7wG6WlPmnaWoQxauUkSEfragsM X9WHMW2ayhirbNMGar2Mx01PtPRIUH/qKJT2tlbDtxTRuNZa4LX3ZbN50Nwv840PpmDU XV1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a17090a9b0e00b002630f63c654si195231pjp.125.2023.07.06.11.27.50; Thu, 06 Jul 2023 11:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbjGFSAX (ORCPT + 99 others); Thu, 6 Jul 2023 14:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbjGFSAT (ORCPT ); Thu, 6 Jul 2023 14:00:19 -0400 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36623BA; Thu, 6 Jul 2023 11:00:19 -0700 (PDT) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-666edfc50deso714096b3a.0; Thu, 06 Jul 2023 11:00:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688666418; x=1691258418; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O+ohPa783boQSqewlPh3vxCWnQt7IOYSt994tq4NfmU=; b=gg0VWv6BtuY/5X5o+b3ZlwpUORD15eYjzDY3E6IanZeSMX23qHkU3Qt8Czj0Okw1VF z8E0YoqpU7/JZSSqo+kI9a8VBF+OLbZS/KNtgLAcYrOjau0T8h7NKap/GujaBB1VqYSB DhEEp4sIb+soApZziM43FXESzk5CJAb15e6tsvxrKikSOX250ruY7Rb1Ml55qP7nWQDU DOzDMIEUldtCosKuLACsAGhQJ1QbwGONtRpNorD1vpf5pSyedK9RCvyP1Ewb/f7Rk95C oARC6lkTKo8y9Waufm46JDTVjnb/sTSH3cV+/8y6jbfLk730XTrIPdqWi4+ct6QjYl83 o88w== X-Gm-Message-State: ABy/qLYAsI0LglTNZLQvWjgWufe3zaBXV8horq2M+z19QIxEos0yBw2J HTEskrIHX6qBjTepRYuvIcfwoqaweNI= X-Received: by 2002:a05:6a00:1a15:b0:682:8505:1e4 with SMTP id g21-20020a056a001a1500b00682850501e4mr4262461pfv.17.1688666418510; Thu, 06 Jul 2023 11:00:18 -0700 (PDT) Received: from ?IPV6:2620:15c:211:201:a75c:9545:5328:a233? ([2620:15c:211:201:a75c:9545:5328:a233]) by smtp.gmail.com with ESMTPSA id a24-20020a62e218000000b00682c8637109sm1561314pfi.34.2023.07.06.11.00.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jul 2023 11:00:17 -0700 (PDT) Message-ID: <43743388-98dc-a446-d7bd-52b45589deeb@acm.org> Date: Thu, 6 Jul 2023 11:00:12 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH RFC 2/7] blk-mq: delay tag fair sharing until fail to get driver tag Content-Language: en-US To: Yu Kuai , axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com References: <20230618160738.54385-1-yukuai1@huaweicloud.com> <20230618160738.54385-3-yukuai1@huaweicloud.com> From: Bart Van Assche In-Reply-To: <20230618160738.54385-3-yukuai1@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/18/23 09:07, Yu Kuai wrote: > Start tag fair sharing when a device start to issue io will waste > resources, same number of tags will be assigned to each disk/hctx, > and such tags can't be used for other disk/hctx, which means a disk/hctx > can't use more than assinged tags even if there are still lots of tags ^^^^^^^^ assigned > that is assinged to other disks are unused. ^^^^^^^^ assigned > Add a new api blk_mq_driver_tag_busy(), it will be called when get > driver tag failed, and move tag sharing from blk_mq_tag_busy() to > blk_mq_driver_tag_busy(). > + spin_lock_irq(&tags->lock); > + WRITE_ONCE(tags->ctl.share_queues, tags->ctl.active_queues); > + blk_mq_update_wake_batch(tags, tags->ctl.share_queues); > + spin_unlock_irq(&tags->lock); > +} Are all tags->ctl.share_queues changes protected by tags->lock? If so, please use a regular assignment to update that member variable instead of using WRITE_ONCE(). > @@ -735,6 +736,7 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, > > struct tag_sharing_ctl { > unsigned int active_queues; > + unsigned int share_queues; > }; Please rename "share_queues" into "shared_queues" such that the names of both struct members start with an adjective. Thanks, Bart.