From patchwork Mon Sep 10 20:49:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10594781 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 4B7C514DB for ; Mon, 10 Sep 2018 20:49:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A1772933C for ; Mon, 10 Sep 2018 20:49:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E8452933E; Mon, 10 Sep 2018 20:49:48 +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 BBFF929348 for ; Mon, 10 Sep 2018 20:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbeIKBpj (ORCPT ); Mon, 10 Sep 2018 21:45:39 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:38847 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbeIKBpi (ORCPT ); Mon, 10 Sep 2018 21:45:38 -0400 Received: by mail-qt0-f194.google.com with SMTP id x7-v6so25869481qtk.5 for ; Mon, 10 Sep 2018 13:49:46 -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=49/3kBvQgmRKTou2gOv3RZG/cAwAbGsJau0m7o7h5AU=; b=f8ptuRF7FZ8IpSs89OUAQqs2S4yuV1tnjW8m1V4TOSEy5ElQfn433kK96tS9A/hbEp Kzk0IpBpEM22fuhB3mCMkPOkHBpIIJNiUJXUPLeHiOJvt73szJ8eYSL46G2kGW4lDwKW XRUhWH2pc3bi4oPsI5CAMz1CAIW6yojfTra9Bv83V+2GvE+trgSy0A7G1JSHYRIBL6Va /FBQAIWoh82PN7FcZ9U2EK69Gh1lZDdpcULvfgXf2Mntgw5rT1J3NM4Ty3wJkrOSSG6/ 3qcEV/fMqTQpTiU0nAhHjWOjBxbIJQcYjaKsV7KvIjlSqYQbKwCZPEmPZI9laBd7LywZ FC7g== 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=49/3kBvQgmRKTou2gOv3RZG/cAwAbGsJau0m7o7h5AU=; b=cKBrca3ijM0tmPQIjCAviYJmxDmB/cZ14sKBpQgOlZgM8e27lW8CkvSusFJHW1V/34 iZBN6boRrVBTVl7PJzJ3EI53QtTGVBQ8Hd+3JhypasKihj2t9Ee0FE9zCJVCTDfd/iwG B1qHfl4F4zrYIrsSQPr929np9azYhSIVEiU895+JBBFUTdTrTbPc93yvWxhQ8kEbqrW4 9SJV9QClKqr2/3QeTUCr3h8ijtIz+1DqsXj8AaCtoPPFrXRsW7uH86xDIuI1Ielkyaav 5u0WC3IgLketndsK//4E6FjJgKaxmbQT60az8PBTIjDYpEKjVA7akgICYSG+/Q0C1AjV XlGg== X-Gm-Message-State: APzg51CAJT2rwRVVJfARYKhnvM5s42yD70U3wbhZrFNApcATDij4kV9n GADUfb4z9YL5YPBDh4QVVtnLsQ== X-Google-Smtp-Source: ANB0Vda1imdU/brrlfl/1vUyjXFa7LUlFhRc5z/5EFkEBcSdcwiCjFY65CNTqeqpP8Q9sr17mQJsVQ== X-Received: by 2002:a0c:e205:: with SMTP id q5-v6mr15542657qvl.224.1536612585984; Mon, 10 Sep 2018 13:49:45 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id v31-v6sm8635319qta.96.2018.09.10.13.49.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Sep 2018 13:49:45 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org Subject: [PATCH 6/6] blk-iolatency: keep track of previous windows stats Date: Mon, 10 Sep 2018 16:49:32 -0400 Message-Id: <20180910204932.14323-7-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180910204932.14323-1-josef@toxicpanda.com> References: <20180910204932.14323-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 e36b949a5696..14c30e01ecc7 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; @@ -592,24 +593,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) { @@ -618,6 +622,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); } @@ -990,6 +995,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;