From patchwork Mon Nov 6 00:38:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Qi X-Patchwork-Id: 10042433 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 74D5D604D3 for ; Mon, 6 Nov 2017 00:39:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59E7329188 for ; Mon, 6 Nov 2017 00:39:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D3BF2918A; Mon, 6 Nov 2017 00:39:25 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 24ACF29188 for ; Mon, 6 Nov 2017 00:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750971AbdKFAjW (ORCPT ); Sun, 5 Nov 2017 19:39:22 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:48275 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbdKFAjW (ORCPT ); Sun, 5 Nov 2017 19:39:22 -0500 Received: by mail-ot0-f193.google.com with SMTP id w76so1517380ota.5 for ; Sun, 05 Nov 2017 16:39:22 -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=f0gbE9S6lhyR1vsxaNmByEERynJ/plO1SXifcdHtxYw=; b=FE0CeC5xiv6agsVBf+7fP04RCJQrxL2+qeMzJdQLbkGyynnNmSGsBqBZaXxAtu1Kga 5r/o6vRbK2SRz1NgEOKJeSlDlWfp019bZrQPThL07YyUGGMRsKWCpjaidQHMoMDSYiuv ERpTBYrU3YlS083KaD4gWWUzdq+pKHEiGRpA4QMNVdEnJsx2l//6+T1TfHD10FquSNrk vBbiNl0Y04E4+d4BlBhfdWEsgjcByiGJRcPZdevd0sIl4bQg5mrobdkx01VW/jVsMy+w EoS1uuqp6oJbDVQG3yrkNYqr0yVDd9rSAbIxizVheDB4/a+aPq6qKe2NUGS85YHxnnfQ 64FQ== 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=f0gbE9S6lhyR1vsxaNmByEERynJ/plO1SXifcdHtxYw=; b=sj8t3EL/pAgrCSwsehbYTNROdiThuItIIE8KiLKIZU5E/o6LvD3KG1u+JEoKZuKIoP X5T2oo3u+wR9Rfho0HaNKFBlxyzPlgqpKzGxXbwfl5HN0Ug/CUYamGl0eMpGV85JE4rA a7i/bn1Movl1DoXlpZshphz+54eE7Rfw+yNha3AStF7cW5Dn40npXp2zRM0XIePw04KW alYG78oOPSdLKeo1BEHJA86AQ3afLUrBsSA62uuXen92yPiOJnN6vOAgjBKCwbp/Mgj3 tfQy2xo/0TRazyypV67p5Hd8ysFJCsZluVreSHdF183VL9qbkWmJDlPfhPySmakk/aJN sl1w== X-Gm-Message-State: AJaThX77Y4SigbU/oQwitdEIF8G0/WpOudi/QSZLECFdQ5W5+axA0kU+ TfgKmaV8ahYH0DauqrYnOCA= X-Google-Smtp-Source: ABhQp+R2v2vX0kde7S5jA98YPbEJ4jKST/Ld+Yw0cVtfrZLFlajCGZnGhQaASPSDyr9BvmpLQEekMQ== X-Received: by 10.157.26.107 with SMTP id u40mr8025171otu.182.1509928761810; Sun, 05 Nov 2017 16:39:21 -0800 (PST) Received: from JosephdeMacBook-Pro.local ([205.204.117.26]) by smtp.gmail.com with ESMTPSA id y57sm5595946oty.79.2017.11.05.16.39.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Nov 2017 16:39:21 -0800 (PST) From: Joseph Qi Subject: [PATCH] blk-throttle: fix wrong initialization in case of dm device To: linux-block , Jens Axboe , Shaohua Li Cc: wenqing.lz@taobao.com, boyu.mt@taobao.com, qijiang.qj@alibaba-inc.com Message-ID: Date: Mon, 6 Nov 2017 08:38:59 +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 set QUEUE_FLAG_NONROT in resume, which is after register queue. 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 --- block/blk-throttle.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 17816a0..6aeb79e 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -539,6 +539,21 @@ static void throtl_pd_init(struct blkg_policy_data *pd) sq->parent_sq = &td->service_queue; if (cgroup_subsys_on_dfl(io_cgrp_subsys) && blkg->parent) sq->parent_sq = &blkg_to_tg(blkg->parent)->service_queue; + + /* + * dm device set QUEUE_FLAG_NONROT in resume, which is after resister + * queue, 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[i].latency = 0; + } tg->td = td; }