From patchwork Sun Jun 18 16:07:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13283776 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33F5AEB64D7 for ; Sun, 18 Jun 2023 08:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbjFRIJF (ORCPT ); Sun, 18 Jun 2023 04:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjFRIJD (ORCPT ); Sun, 18 Jun 2023 04:09:03 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E595510D7; Sun, 18 Jun 2023 01:09:01 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4QkQX83vb2z4f3nyX; Sun, 18 Jun 2023 16:08:56 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgAHoZSXu45kz8rjLw--.30784S4; Sun, 18 Jun 2023 16:08:58 +0800 (CST) From: Yu Kuai To: bvanassche@acm.org, axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH RFC 0/7] blk-mq: improve tag fair sharing Date: Mon, 19 Jun 2023 00:07:31 +0800 Message-Id: <20230618160738.54385-1-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 MIME-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Xa7sRi Pl1DUUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Yu Kuai This is not a formal version and not fully tested, I send this RFC because I want to make sure if people think doing this is meaningful, before I spend too much time on this. This patchset tries to refactor how tag is shared: - patch 2 delay tag sharing from issue io to when get driver tag faild; - patch 3 support to access which queues/hctxs is sharing tags through blk_mq_tags; - patch 4 move the caculation that how many tags is available from hctx_may_queue() to when queue/hctx start or stop to sharing tags. - patch 5 record new information that how many times fail to get driver tag recently; And patch 7 use this to adjust available tags for each shared queue. Yu Kuai (7): blk-mq: factor out a structure from blk_mq_tags to control tag sharing blk-mq: delay tag fair sharing until fail to get driver tag blk-mq: support to track active queues from blk_mq_tags blk-mq: precalculate available tags for hctx_may_queue() blk-mq: record the number of times fail to get driver tag while sharing tags blk-mq: move active request counter to struct tag_sharing blk-mq: allow shared queue to get more driver tags block/blk-core.c | 2 - block/blk-mq-debugfs.c | 6 +- block/blk-mq-tag.c | 154 ++++++++++++++++++++++++++++++++++++++--- block/blk-mq.c | 10 ++- block/blk-mq.h | 39 ++++++----- include/linux/blk-mq.h | 24 ++++--- include/linux/blkdev.h | 13 +++- 7 files changed, 201 insertions(+), 47 deletions(-)