From patchwork Wed Jul 11 14:34:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10520009 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 62A12601D4 for ; Wed, 11 Jul 2018 14:34:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C96DE28FC5 for ; Wed, 11 Jul 2018 14:34:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC0362915C; Wed, 11 Jul 2018 14:34:46 +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 4EB2428FC5 for ; Wed, 11 Jul 2018 14:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388409AbeGKOjX (ORCPT ); Wed, 11 Jul 2018 10:39:23 -0400 Received: from mail-qk0-f177.google.com ([209.85.220.177]:35962 "EHLO mail-qk0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388075AbeGKOjW (ORCPT ); Wed, 11 Jul 2018 10:39:22 -0400 Received: by mail-qk0-f177.google.com with SMTP id a132-v6so13666484qkg.3 for ; Wed, 11 Jul 2018 07:34:44 -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; bh=IAO9oYLotU1xrzeq5rXKQPTxKiYzqKszzH1/FJrrRTU=; b=HVGSrIuVDFn83144UIGVTnTtF7S4hU3+68PGkfH7e0CIH94otBnEOa7zYiec7Hoaxg X4to0/qdgFRzO7stIWYGA/2JHdJ4XqPPrTjHJFDyLE2mWsY8GuBgGpUc0kAzhXGnZdMR 4w0Bfd8sVzuoOxV8y6anumOSpBnQ4FVGSb+lnMTJpDB8oHxeiMnCVWmYTxlo9aZlqyEI PLoVMUUsAeS21uX+LHmZfVZwcAaaFcu3eidYLO345DF07gzRi2w1PnNy0sjAZ+qu0GOo jK6CJ+KtVdPoU75Z6Gjq5IOXTg/3RThPP7OKUWsKeCA/NdGkeY1ir+qtIhidzHP2Za04 jnlQ== 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; bh=IAO9oYLotU1xrzeq5rXKQPTxKiYzqKszzH1/FJrrRTU=; b=BP0aAvjo7ODolz8T8E4smhdocFqJmKJnMSHNwqYN9qoyrq4BZHoBq+HMEt/mgMg0T8 WSYi94evoMYkaQkjhHABJjMJ8tV3UeRmZLbOtek4ZenzoiiSCIT5jFZPfuwb3DrjCVO0 XlVQSsqoWq7Nv5+CLVkWbd0v27C8TbIwUT7BHGY5xnuTaHblY35vW+fCg0LkYpxN3fuH 3PckqbKhGCT3TIPmgmlcREI6kgagsURDyii8lTv+LtBHMg4gp7zTFKFTkiiRk2k8V9WE AKwyldR1ZucEcnuSDthCgS8dci9Q3zNoGPoyucm0jG9lhRyN3CoyE4vmNoD8wTCHnPNr 9sCg== X-Gm-Message-State: APt69E3jijTqYoaciGBX6OeLxhFxUUeBSSl92xFhpQRsXQNf1h/ENfob 6th060nmm+byf9LYCd3HBKC4Jw== X-Google-Smtp-Source: AAOMgpdqMlmRP9pxqtQ8ro7Bj+6WAfUMgWFWTCddQHaF8BUWT62fKDe3MJXCtQwrJDd8tgqncbZZBg== X-Received: by 2002:a37:3a45:: with SMTP id h66-v6mr26813511qka.118.1531319684176; Wed, 11 Jul 2018 07:34:44 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id o71-v6sm17474919qki.55.2018.07.11.07.34.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 07:34:43 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH][v2] blk-iolatency: fix max_depth comparisons Date: Wed, 11 Jul 2018 10:34:42 -0400 Message-Id: <20180711143442.16566-1-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 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 max_depth used to be a u64, but I changed it to a unsigned int but didn't convert my comparisons over everywhere. Fix by using UINT_MAX everywhere instead of (u64)-1. Reported-by: Dan Carpenter Signed-off-by: Josef Bacik --- - use UINT_MAX instead of INT_MAX. block/blk-iolatency.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index a35a1f580337..3ae647d9203f 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -9,8 +9,8 @@ * - We use the mean latency over the 100ms window. This is because writes can * be particularly fast, which could give us a false sense of the impact of * other workloads on our protected workload. - * - By default there's no throttling, we set the queue_depth to INT_MAX so that - * we can have as many outstanding bio's as we're allowed to. Only at + * - By default there's no throttling, we set the queue_depth to UINT_MAX so + * that we can have as many outstanding bio's as we're allowed to. Only at * throttle time do we pay attention to the actual queue depth. * * The hierarchy works like the cpu controller does, we track the latency at @@ -361,7 +361,7 @@ static void check_scale_change(struct iolatency_grp *iolat) /* We're back to the default cookie, unthrottle all the things. */ if (cur_cookie == DEFAULT_SCALE_COOKIE) { blkcg_clear_delay(lat_to_blkg(iolat)); - iolat->rq_depth.max_depth = INT_MAX; + iolat->rq_depth.max_depth = UINT_MAX; wake_up_all(&iolat->rq_wait.wait); return; } @@ -434,7 +434,7 @@ static void iolatency_record_time(struct iolatency_grp *iolat, * We don't want to count issue_as_root bio's in the cgroups latency * statistics as it could skew the numbers downwards. */ - if (unlikely(issue_as_root && iolat->rq_depth.max_depth != (u64)-1)) { + if (unlikely(issue_as_root && iolat->rq_depth.max_depth != UINT_MAX)) { u64 sub = iolat->min_lat_nsec; if (req_time < sub) blkcg_add_delay(lat_to_blkg(iolat), now, sub - req_time); @@ -817,7 +817,7 @@ static size_t iolatency_pd_stat(struct blkg_policy_data *pd, char *buf, struct iolatency_grp *iolat = pd_to_lat(pd); unsigned long long avg_lat = div64_u64(iolat->total_lat_avg, NSEC_PER_USEC); - if (iolat->rq_depth.max_depth == (u64)-1) + if (iolat->rq_depth.max_depth == UINT_MAX) return scnprintf(buf, size, " depth=max avg_lat=%llu", avg_lat); @@ -860,7 +860,7 @@ static void iolatency_pd_init(struct blkg_policy_data *pd) rq_wait_init(&iolat->rq_wait); spin_lock_init(&iolat->child_lat.lock); iolat->rq_depth.queue_depth = blk_queue_depth(blkg->q); - iolat->rq_depth.max_depth = INT_MAX; + iolat->rq_depth.max_depth = UINT_MAX; iolat->rq_depth.default_depth = iolat->rq_depth.queue_depth; iolat->blkiolat = blkiolat; iolat->cur_win_nsec = 100 * NSEC_PER_MSEC;