From patchwork Tue Nov 21 01:42:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Qi X-Patchwork-Id: 10067589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5800A603FA for ; Tue, 21 Nov 2017 01:42:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49275289CE for ; Tue, 21 Nov 2017 01:42:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E02C292F4; Tue, 21 Nov 2017 01:42:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4B4D292E3 for ; Tue, 21 Nov 2017 01:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbdKUBmS (ORCPT ); Mon, 20 Nov 2017 20:42:18 -0500 Received: from mail-oi0-f66.google.com ([209.85.218.66]:37280 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253AbdKUBmR (ORCPT ); Mon, 20 Nov 2017 20:42:17 -0500 Received: by mail-oi0-f66.google.com with SMTP id y206so7500355oiy.4 for ; Mon, 20 Nov 2017 17:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=fNuhTW+fm9/+pT3B7ZrDHmI9hylQrhvQKtiUGPgQjDg=; b=VIh3htsf9HTdL7CDMnyeuxxp7R6Up9BdMNZWLcU5ve9l6SScSpXlbGwRSkItI/ZzG3 E2D332hMl8r1sktJ33M6ZS+6bFRAosjugJC6FiV5pyPt9poEa0NVvbYx3adWreaLvqqj Bn0sBuqjYHLs+o1abQyWPb6xc5o1l/dfaNkw/A+uYvEwvd8qdOrf8WGXW+D45yEjje3W G2IKub5ldHTFAKNgD7NBjcc9dPCiO8GKj95ca4dA+7P9VBIcKPsv+o0Vd/Y6333bbRUu NPwfQk0pNbUwI3xHnLbcXlIcLaDXFh2ms9nGVTai5+xWX1xBDak0+/HR3mPh1ddaYUcQ pbiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=fNuhTW+fm9/+pT3B7ZrDHmI9hylQrhvQKtiUGPgQjDg=; b=JcmigWVpJxhIWjt5pQ/LZDG+E30sYfPPFuYaSf+cg/bU1GEzKpkTDp6hbc1M4A1jgH Pbb2QXTKO57mYtGhSzxddlLcS+au4+YoJ9E0A+uuJPseGce+7lMiFJcPoeGAwoLt4nZY 5D/WErTcqYSOt6iPkGe/b4SnDVQjZ+y8P1U8iqF2d1IIIjzAecw7KJcyDmEA91jrklIE VmqQFeYYRv8D9d/LdZUUG12RcniuodXMipjUxHcxUG0UpSE4sP50UYswsdEt/4Cpd871 HtJCxkUQ7yTWSi1NNjdgi58B03MTwu5da/1C5TbuP8P8VeSpqlX2bCF7GxZt/c5BGtIO 8Wsw== X-Gm-Message-State: AJaThX6NRn+VotEF5se2M2YuzlavV0+No2epdc/ER2cTP3u7zLwYKV63 /Xpp0fbvXa0XS0VeMlE6gBo= X-Google-Smtp-Source: AGs4zMbmNVOxBJlB6m1f6F7jAB9G3qN4Hv3hbpxy3z6c23G88vI0bYdKp4OT6rPoN912dioxIaRtxw== X-Received: by 10.202.95.213 with SMTP id t204mr143180oib.31.1511228537097; Mon, 20 Nov 2017 17:42:17 -0800 (PST) Received: from JosephdeMacBook-Pro.local ([205.204.117.3]) by smtp.gmail.com with ESMTPSA id e34sm5502704otc.38.2017.11.20.17.42.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 17:42:16 -0800 (PST) From: Joseph Qi Subject: [PATCH v3 2/2] blk-throttle: fix wrong initialization in case of dm device To: Jens Axboe Cc: linux-block , device-mapper development , Shaohua Li , Mike Snitzer , qijiang.qj@alibaba-inc.com Message-ID: <686ebf99-3c0a-491b-7df5-70740bebceeb@gmail.com> Date: Tue, 21 Nov 2017 09:42:11 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joseph Qi DM device sets QUEUE_FLAG_NONROT after the queue is registered. That is to mean, the previous initialization in blk_throtl_register_queue is wrong in this case. Fix it by checking and then updating the info during root tg initialization as we don't have a better choice. Signed-off-by: Joseph Qi Reviewed-by: Shaohua Li --- block/blk-throttle.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index bf52035..7150f14 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -541,6 +541,25 @@ static void throtl_pd_init(struct blkg_policy_data *pd) if (cgroup_subsys_on_dfl(io_cgrp_subsys) && blkg->parent) sq->parent_sq = &blkg_to_tg(blkg->parent)->service_queue; tg->td = td; + +#ifdef CONFIG_BLK_DEV_THROTTLING_LOW + /* + * DM device sets QUEUE_FLAG_NONROT after the queue is registered, + * so the previous initialization is wrong in this case. Check and + * update it here. + */ + if (blk_queue_nonrot(blkg->q) && + td->filtered_latency != LATENCY_FILTERED_SSD) { + int i; + + td->throtl_slice = DFL_THROTL_SLICE_SSD; + td->filtered_latency = LATENCY_FILTERED_SSD; + for (i = 0; i < LATENCY_BUCKET_SIZE; i++) { + td->avg_buckets[READ][i].latency = 0; + td->avg_buckets[WRITE][i].latency = 0; + } + } +#endif } /*