Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1705614pxb; Wed, 9 Feb 2022 02:42:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSPpGwhFDMGeGaatCJ8YQQOMl+TkOzlu2ReklMU0Bq2Q7rWut58LUxLt3qY49ojnc2VyCI X-Received: by 2002:a05:6a00:1d27:: with SMTP id a39mr786811pfx.55.1644403333809; Wed, 09 Feb 2022 02:42:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644403333; cv=none; d=google.com; s=arc-20160816; b=IRPee2WAe72ZBSeYhZT7q6Y8HG1slacL15Hgfc2kpBPhQhbPxQ+ZLT8qSieCTCOUhb Ph1RizGBfYMSaGEKPl7QflUG6dED1ty5tNefF6LW2R0vdl0Jf2FXP0NhMVf8fBnUA5m8 2Y925xQCTS6Llb6+oW+m2n3QGDZB3Nd/aBKUWJhNwsM2/gnQh6p++CJ79KOhaPIP9q9R Z4s/XPU1uGHg29ETF/XungxL57+g9b61lrzVB+3KHpKaj6yplexxyKQj/51Qwc1Cp8nJ Wo1IgGzVZbpD0XCrs57XWs1rafqdnXm4GeDJzlXXp2yZZA5yfkDGnd/tKvMSfbLs4CCx W/sg== 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:cc :references:to:from:subject:user-agent:mime-version:date:message-id; bh=GUrXaQgDYQ0YGUmzHARVonCoF/arPGGAbuS3awJxHFA=; b=fSSkSxWLMxd5+AgoZOlV0C6MSuYOlaVmOqOf/f+eIoAIhKUDmInVgTjmpt6qxBI24x R6OCPQquBBJnbrhHaLQ4xajM4q0pTORFRvVfreTlIOsXbnMe2eVNiNqxdbcmY2J+92vr ziapYC1YeInAJPYPi8PPD1EJ5V5/VL8OxoycBIbLBNvPZJOVoUxoXaIlioTCY3ObCqXZ U3dpm/A5jIVfgg3s/qHToo98TfQ2aPym68TddrsWyekcjJqh1e69RnZc+7OmzrWo75uL V5PZNv+1TMTTG42xFT25SKDymHeOS/OTolFutMBs1+CrHu+LgiTama4qHT5aadOnC0qa Lo9w== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c10si4805833pji.139.2022.02.09.02.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:42:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C4645E056C27; Wed, 9 Feb 2022 01:24:54 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236713AbiBHCNB (ORCPT + 99 others); Mon, 7 Feb 2022 21:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230123AbiBHCM7 (ORCPT ); Mon, 7 Feb 2022 21:12:59 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8819C061355; Mon, 7 Feb 2022 18:12:58 -0800 (PST) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jt62j1PC2zccRR; Tue, 8 Feb 2022 10:11:57 +0800 (CST) Received: from [10.174.176.103] (10.174.176.103) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Tue, 8 Feb 2022 10:12:56 +0800 Message-ID: <6e7fe188-a258-8d10-2f86-027c6b6f434c@huawei.com> Date: Tue, 8 Feb 2022 10:12:56 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH -next] block: update io_ticks when io hang From: "zhangwensheng (E)" To: References: <20220125091938.1799001-1-zhangwensheng5@huawei.com> <45c2ae11-c44e-f27d-f029-66efe96b0804@huawei.com> CC: , In-Reply-To: <45c2ae11-c44e-f27d-f029-66efe96b0804@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.103] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,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 friendly ping... 在 2022/1/28 14:22, zhangwensheng (E) 写道: > friendly ping... > > 在 2022/1/25 17:19, Zhang Wensheng 写道: >> When the inflight IOs are slow and no new IOs are issued, we expect >> iostat could manifest the IO hang problem. However after >> commit 5b18b5a73760 ("block: delete part_round_stats and switch to less >> precise counting"), io_tick and time_in_queue will not be updated until >> the end of IO, and the avgqu-sz and %util columns of iostat will be >> zero. >> >> Because it has using stat.nsecs accumulation to express time_in_queue >> which is not suitable to change, and may %util will express the status >> better when io hang occur. To fix io_ticks, we use update_io_ticks and >> inflight to update io_ticks when diskstats_show and part_stat_show >> been called. >> >> Fixes: 5b18b5a73760 ("block: delete part_round_stats and switch to >> less precise counting") >> Signed-off-by: Zhang Wensheng >> --- >>   block/genhd.c | 8 ++++++-- >>   1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/block/genhd.c b/block/genhd.c >> index 626c8406f21a..df0656ffb4ad 100644 >> --- a/block/genhd.c >> +++ b/block/genhd.c >> @@ -913,12 +913,14 @@ ssize_t part_stat_show(struct device *dev, >>       struct disk_stats stat; >>       unsigned int inflight; >>   -    part_stat_read_all(bdev, &stat); >>       if (queue_is_mq(q)) >>           inflight = blk_mq_in_flight(q, bdev); >>       else >>           inflight = part_in_flight(bdev); >>   +    if (inflight) >> +        update_io_ticks(bdev, jiffies, true); >> +    part_stat_read_all(bdev, &stat); >>       return sprintf(buf, >>           "%8lu %8lu %8llu %8u " >>           "%8lu %8lu %8llu %8u " >> @@ -1174,12 +1176,14 @@ static int diskstats_show(struct seq_file >> *seqf, void *v) >>       xa_for_each(&gp->part_tbl, idx, hd) { >>           if (bdev_is_partition(hd) && !bdev_nr_sectors(hd)) >>               continue; >> -        part_stat_read_all(hd, &stat); >>           if (queue_is_mq(gp->queue)) >>               inflight = blk_mq_in_flight(gp->queue, hd); >>           else >>               inflight = part_in_flight(hd); >>   +        if (inflight) >> +            update_io_ticks(hd, jiffies, true); >> +        part_stat_read_all(hd, &stat); >>           seq_printf(seqf, "%4d %7d %pg " >>                  "%lu %lu %lu %u " >>                  "%lu %lu %lu %u "