From patchwork Mon Nov 20 02:00:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Qi X-Patchwork-Id: 10065863 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 10E566023A for ; Mon, 20 Nov 2017 02:00:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B52D28F70 for ; Mon, 20 Nov 2017 02:00:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 103C428F80; Mon, 20 Nov 2017 02:00:34 +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 7D0D528F7A for ; Mon, 20 Nov 2017 02:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751132AbdKTCAc (ORCPT ); Sun, 19 Nov 2017 21:00:32 -0500 Received: from mail-oi0-f65.google.com ([209.85.218.65]:42858 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751087AbdKTCAc (ORCPT ); Sun, 19 Nov 2017 21:00:32 -0500 Received: by mail-oi0-f65.google.com with SMTP id p23so2098967oie.9 for ; Sun, 19 Nov 2017 18:00:32 -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=W92Ox0hKuliYltyko86dKPf7KiuTaKfqD3xNmvfxjcQ=; b=S8EmbD727RhCbAoNkc2AdwwZrXj+2bzjnJaslIBECxnePoWue0zXyRIaRD7cdgac2p RtwdF5a0N1mdPh/nWcVJELNZGkRT/vaObnLGMQCCIZUCO+8z4lhz12oWwlegDgMJ8dWP 4PBpnG7rXsgWY1EvLW857VdGNfVM6qZeHnBs+IXRuneacHNcnNB9drYmZY4EVKoHvM7O ZTnqQCEkHxXMVRSLK2phm5gdwhnBtLbuCksd7DiJxzY2vl5TLwSSxIvd5t2Ubw7YLRQh JL25iR7gF2gZYLqH9ym52q+a4TTXq6/UKa7YsFjNk+4s2K8LValhlA9PY/2gtG/BMUDP KsHw== 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=W92Ox0hKuliYltyko86dKPf7KiuTaKfqD3xNmvfxjcQ=; b=pJL5qjoTlFOmUvPvJEZWHlO7+M93XedBg4P+lm3G+FVbhEIcy4P7xWljhWrXSRnnI1 Q4TgIsvuVicXKRNm7AhFwKi/ifSFUxXRCHNyY3l2TpP+2Q/Ke+K3qGjXWyYjLN/6i5IK IK63n1Gkd6KOWY3UNjOtYlP2oOezwmbGTBgIpqAYKhuFnYMK6LyEOxydTS4AKSxz8pPY Y8KkQ32ikc/GrEIA7KrVtjlLP8JC5C36DbreOkmeIfUD5aYObTJpmVUoWbfbuoOsdXeZ STAHbKATEJDhh5p/dcC2ojTnN5apnIitGBwxaLRqIZtW4qrgcj9VxdpLsFi1Pv2HFti/ RVpg== X-Gm-Message-State: AJaThX4bzSbBQtjIxNb/kjMHQlN5quwSghrjmHzcdo4ex5cftAaQoW/y AIPYhrXMFSx8gTSr8r0tYpNnN62a X-Google-Smtp-Source: AGs4zMboH1d+FoPzxvIvO76V2VrOIPNxWosdDWe606zDQ28Cic+srsI2bN1kwJND6x99F/fgPa11gA== X-Received: by 10.202.95.213 with SMTP id t204mr5487905oib.31.1511143231675; Sun, 19 Nov 2017 18:00:31 -0800 (PST) Received: from JosephdeMacBook-Pro.local ([205.204.117.3]) by smtp.gmail.com with ESMTPSA id t124sm4076271oih.48.2017.11.19.18.00.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Nov 2017 18:00:31 -0800 (PST) From: Joseph Qi Subject: [PATCH v2 2/2] blk-throttle: fix wrong initialization in case of dm device To: Jens Axboe , Shaohua Li , linux-block Cc: qijiang.qj@alibaba-inc.com Message-ID: <241a6fbe-f2d2-3d11-ba45-afc5b02de9c2@gmail.com> Date: Mon, 20 Nov 2017 10:00:27 +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 Reviewed-by: Shaohua Li --- block/blk-throttle.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index bf52035..6d6b220 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -541,6 +541,23 @@ 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; + + /* + * 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[READ][i].latency = 0; + td->avg_buckets[WRITE][i].latency = 0; + } + } } /*