From patchwork Fri Sep 28 17:45:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10620235 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31A5F15A7 for ; Fri, 28 Sep 2018 17:45:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FE892BEB6 for ; Fri, 28 Sep 2018 17:45:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 148F12BF88; Fri, 28 Sep 2018 17:45:59 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 07F212BEB6 for ; Fri, 28 Sep 2018 17:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbeI2AKs (ORCPT ); Fri, 28 Sep 2018 20:10:48 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:37593 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbeI2AKs (ORCPT ); Fri, 28 Sep 2018 20:10:48 -0400 Received: by mail-qt1-f195.google.com with SMTP id n6-v6so7554668qtl.4 for ; Fri, 28 Sep 2018 10:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=LaCfN37N4Q7co/matB6j6Ioo5GEb6qKti52y2BDjg8o=; b=fJQLb2LVpQUIV2IFMjBbXXrg5g8An9MwkbUJEVBiAAEy8xLztAxoOT8NBCL4KWX2PF tfThrpb/E6kAPZXL2Tv158NNrwgQWHVgphy4tr5Gud+EQVDu9wRssTL3GF8yw8ZoEpCh x9xkVqN4JSb3suxtPBRKNoWu3VmjoGyqvgdlMVcZ3b7ql340BD5lr52PgiO95GdO34Ld hUr9FomtW5EaEV0uI3/sLUAknywdQY89q4/pnBHpeAbj+ikG1Qgf1whCbCsB+VYbEp7o KYMnhRS0caZXS7RwrK7uFwXZAduEBfeFUpPTs4g6GLkvkRYJie0mKYwWYr8zde2PGi/S FBeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=LaCfN37N4Q7co/matB6j6Ioo5GEb6qKti52y2BDjg8o=; b=CTXypHqIM0nvGhLLJnHS8xUHe709wT8H0f2a5/A6mAuH4xWJ6OTCkw2i5iow8HUOA5 tXfLETw6VXOTHn32s3LdgzqDYDwhCTG8IG+GEfTkHdLoMPnQrxr+VUAFN9tT2FhkOq9I 0i1oq+0Z9izZevZpLazqtNEoUC3MyMr7szXCjZj9LFC+wQilE94cwvN9D3ag0Arh9Dkj zpdb0XycVjUV95OMXgwKUys/gavamqQ42vIlUH9qEtWYcbnk0N/PskFRQuej5hgHz3Yx rRZu8hNJfWejrWvGHodMYdqPsLtt11pyik4sYXz5VGEpPAzGLBZp6/pergQV9kAm/f3+ lJSw== X-Gm-Message-State: ABuFfoiSeSnWNJ2RmzyUqRXBbnTxhKfsuHGj2SIEL7BzN09SZED972oH DPzuqTp5z5p8NNo+DqD6NAWpNw== X-Google-Smtp-Source: ACcGV61JxQt+oQ5o5rsTNljmiLBTXuMTw20nPhSyypYFII2Rl+CiRtB8NMkE0R/XQBuDtcuARSG6ow== X-Received: by 2002:aed:3983:: with SMTP id m3-v6mr13450190qte.164.1538156756066; Fri, 28 Sep 2018 10:45:56 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id e206-v6sm2778599qkb.4.2018.09.28.10.45.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Sep 2018 10:45:55 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 5/5] blk-iolatency: keep track of previous windows stats Date: Fri, 28 Sep 2018 13:45:43 -0400 Message-Id: <20180928174543.28486-6-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180928174543.28486-1-josef@toxicpanda.com> References: <20180928174543.28486-1-josef@toxicpanda.com> 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 We apply a smoothing to the scale changes in order to keep sawtoothy behavior from occurring. However our window for checking if we've missed our target can sometimes be lower than the smoothing interval (500ms), especially on faster drives like ssd's. In order to deal with this keep track of the running tally of the previous intervals that we threw away because we had already done a scale event recently. This is needed for the ssd case as these low latency drives will have bursts of latency, and if it happens to be ok for the window that directly follows the opening of the scale window we could unthrottle when previous windows we were missing our target. Signed-off-by: Josef Bacik --- block/blk-iolatency.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index fd246805b0be..35c48d7b8f78 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -130,6 +130,7 @@ struct latency_stat { struct iolatency_grp { struct blkg_policy_data pd; struct latency_stat __percpu *stats; + struct latency_stat cur_stat; struct blk_iolatency *blkiolat; struct rq_depth rq_depth; struct rq_wait rq_wait; @@ -570,24 +571,27 @@ static void iolatency_check_latencies(struct iolatency_grp *iolat, u64 now) /* Somebody beat us to the punch, just bail. */ spin_lock_irqsave(&lat_info->lock, flags); + + latency_stat_sum(iolat, &iolat->cur_stat, &stat); lat_info->nr_samples -= iolat->nr_samples; - lat_info->nr_samples += latency_stat_samples(iolat, &stat); - iolat->nr_samples = latency_stat_samples(iolat, &stat); + lat_info->nr_samples += latency_stat_samples(iolat, &iolat->cur_stat); + iolat->nr_samples = latency_stat_samples(iolat, &iolat->cur_stat); if ((lat_info->last_scale_event >= now || - now - lat_info->last_scale_event < BLKIOLATENCY_MIN_ADJUST_TIME) && - lat_info->scale_lat <= iolat->min_lat_nsec) + now - lat_info->last_scale_event < BLKIOLATENCY_MIN_ADJUST_TIME)) goto out; - if (latency_sum_ok(iolat, &stat)) { - if (latency_stat_samples(iolat, &stat) < + if (latency_sum_ok(iolat, &iolat->cur_stat) && + latency_sum_ok(iolat, &stat)) { + if (latency_stat_samples(iolat, &iolat->cur_stat) < BLKIOLATENCY_MIN_GOOD_SAMPLES) goto out; if (lat_info->scale_grp == iolat) { lat_info->last_scale_event = now; scale_cookie_change(iolat->blkiolat, lat_info, true); } - } else { + } else if (lat_info->scale_lat == 0 || + lat_info->scale_lat >= iolat->min_lat_nsec) { lat_info->last_scale_event = now; if (!lat_info->scale_grp || lat_info->scale_lat > iolat->min_lat_nsec) { @@ -596,6 +600,7 @@ static void iolatency_check_latencies(struct iolatency_grp *iolat, u64 now) } scale_cookie_change(iolat->blkiolat, lat_info, false); } + latency_stat_init(iolat, &iolat->cur_stat); out: spin_unlock_irqrestore(&lat_info->lock, flags); } @@ -966,6 +971,7 @@ static void iolatency_pd_init(struct blkg_policy_data *pd) latency_stat_init(iolat, stat); } + latency_stat_init(iolat, &iolat->cur_stat); rq_wait_init(&iolat->rq_wait); spin_lock_init(&iolat->child_lat.lock); iolat->rq_depth.queue_depth = blkg->q->nr_requests;