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: 10067961 X-Patchwork-Delegate: snitzer@redhat.com 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 C11346022E for ; Tue, 21 Nov 2017 10:49:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC11B28FB1 for ; Tue, 21 Nov 2017 10:49:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0D2528FCA; Tue, 21 Nov 2017 10:49:16 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 26DCA28FB1 for ; Tue, 21 Nov 2017 10:49:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54B2183F42; Tue, 21 Nov 2017 10:49:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38EB76046E; Tue, 21 Nov 2017 10:49:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1092C1800BDA; Tue, 21 Nov 2017 10:49:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAL1gMPK030087 for ; Mon, 20 Nov 2017 20:42:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id CB4FF5D757; Tue, 21 Nov 2017 01:42:22 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1426F5EDE0; Tue, 21 Nov 2017 01:42:19 +0000 (UTC) Received: from mail-oi0-f68.google.com (mail-oi0-f68.google.com [209.85.218.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFD693680B; Tue, 21 Nov 2017 01:42:17 +0000 (UTC) Received: by mail-oi0-f68.google.com with SMTP id a81so7486048oii.13; 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=KHcsveIwUp48hAMXHCyZuj9FgTYVt9f0OcVvRtS2KLytkqdVvaGhuh/f12l91v+upN 4tAorl1JCEbGrAeaULusTcqO4fuBtnln5elwpo66IiuOLmBskFqoLx5pB0cg5UTgx7l4 cKUBKNq7YBQpwUG4hC/HCYwxHeJ9iRoinYT1odpCXXjMCy71b5sVRRb/AZS5BzyTdgxg xf1WV12XRhCLrpD6fpBLEJ8DVyVaG3aSmqnnbxz3rncn7VMRawRvnzrOEvny3ZZOCOFx 1y1N2M2ey80ZybxgwTcskhD5//vY3cVQ+MGJ41dDry6xNHiZQibYJXMuysyP6xWwmYQV iDjg== X-Gm-Message-State: AJaThX5srr5k8LAgjB5H0dG0vqSpoLCLXzY6cQvUP4NZP+Hs2tWR+SUX Bvh7XBk3EkjJDCDYNH3/uwA= 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 To: Jens Axboe 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 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Nov 2017 01:42:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Nov 2017 01:42:17 +0000 (UTC) for IP:'209.85.218.68' DOMAIN:'mail-oi0-f68.google.com' HELO:'mail-oi0-f68.google.com' FROM:'jiangqi903@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.218.68 mail-oi0-f68.google.com 209.85.218.68 mail-oi0-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Tue, 21 Nov 2017 05:48:47 -0500 Cc: linux-block , device-mapper development , Shaohua Li , qijiang.qj@alibaba-inc.com, Mike Snitzer Subject: [dm-devel] [PATCH v3 2/2] blk-throttle: fix wrong initialization in case of dm device X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Nov 2017 10:49:15 +0000 (UTC) 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 } /*