Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7156055ybi; Mon, 8 Jul 2019 15:46:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1hkllgSCGLAvCvvnTRllTW1GI1on9IC9oluZMYY18s9w3BU3xeg1l0MKkIuVQg5OkQWoy X-Received: by 2002:a17:902:8546:: with SMTP id d6mr27146269plo.207.1562626017779; Mon, 08 Jul 2019 15:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562626017; cv=none; d=google.com; s=arc-20160816; b=QDyIB/qUsb4qJPsdMKelR1qqKFO2WX+eFJ7cl48PZk8bXlsX8ckfNCRu+jm0rYQQny TTwG+vGfPzVTyAppMdU2EBeBMlOuLv94Y7y5JIOXst8XxlmIw8hhv/GEJ2OklSWbokQ0 LsvCEqA9EpC8uj2xPE3Cy+oVZB8pf+06IjzccABoGh+vreYntAIHuTm7H2yK/uS+fNr8 lRfmA8oet4UAQ2Olgm6l3MvaO6fGAPUhFQd8mihaKifOTtfgAHRygVRI+p/W+36CK9do fiEMOk4auPMTRd/FMeFRLouiWnQNdpB/9qRqxFyvZnKJUpBKMvvT99KA7qGM1rWTiB0+ /udA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=90aoiYVCELj0551M+wxfGLJjVSVoUd6r+RG6fukbPeM=; b=DKvuEf/NtFYeuAxJ20jflKuGFcJ/yEv3mSbVXxq5+mnivjbPvZ/2cQBt35e0hhv6lj 4UaV70HmgWPVcsv3qNC07uusSkkftDPWO+w9TaHeUvNL9EuD5xMo7mNws3u+ZgvdUwPD tRnufK/w40BFdm3EmdCnh1g9ia96NI6CrPmOAGD539q5rHL6n6D1NTMxjanlMcyqHyR5 BjEnsNODRW6cnAm6t2n4+u0D2QL5qq3vMMB2S2k2RaIU9XHSHb13ikZlCphvChjJz8xi 6f5vho5araSgP8o3KH8sVawqviRwHjLpiUnIOCVBj7uHnsL1yu4g0UhWbhZM6b5TlkVO 7A3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16si795848pjt.12.2019.07.08.15.46.43; Mon, 08 Jul 2019 15:46:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390855AbfGHTJ6 (ORCPT + 99 others); Mon, 8 Jul 2019 15:09:58 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:54421 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731402AbfGHTJ5 (ORCPT ); Mon, 8 Jul 2019 15:09:57 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=bo.liu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TWPWMSM_1562612890; Received: from US-160370MP2.local(mailfrom:bo.liu@linux.alibaba.com fp:SMTPD_---0TWPWMSM_1562612890) by smtp.aliyun-inc.com(127.0.0.1); Tue, 09 Jul 2019 03:08:12 +0800 Date: Mon, 8 Jul 2019 12:08:09 -0700 From: Liu Bo To: Konstantin Khlebnikov Cc: linux-block@vger.kernel.org, Jens Axboe , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] blk-throttle: fix zero wait time for iops throttled group Message-ID: <20190708190809.l4fdhigexzdujvuv@US-160370MP2.local> Reply-To: bo.liu@linux.alibaba.com References: <156259979778.2486.6296077059654653057.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <156259979778.2486.6296077059654653057.stgit@buzz> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 08, 2019 at 06:29:57PM +0300, Konstantin Khlebnikov wrote: > After commit 991f61fe7e1d ("Blk-throttle: reduce tail io latency when iops > limit is enforced") wait time could be zero even if group is throttled and > cannot issue requests right now. As a result throtl_select_dispatch() turns > into busy-loop under irq-safe queue spinlock. > > Fix is simple: always round up target time to the next throttle slice. > > Fixes: 991f61fe7e1d ("Blk-throttle: reduce tail io latency when iops limit is enforced") > Signed-off-by: Konstantin Khlebnikov > Cc: stable@vger.kernel.org # v4.19+ > --- > block/blk-throttle.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/block/blk-throttle.c b/block/blk-throttle.c > index 9ea7c0ecad10..8ab6c8153223 100644 > --- a/block/blk-throttle.c > +++ b/block/blk-throttle.c > @@ -881,13 +881,10 @@ static bool tg_with_in_iops_limit(struct throtl_grp *tg, struct bio *bio, > unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; > u64 tmp; > > - jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw]; > - > - /* Slice has just started. Consider one slice interval */ > - if (!jiffy_elapsed) > - jiffy_elapsed_rnd = tg->td->throtl_slice; > + jiffy_elapsed = jiffies - tg->slice_start[rw]; > > - jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); > + /* Round up to the next throttle slice, wait time must be nonzero */ > + jiffy_elapsed_rnd = roundup(jiffy_elapsed + 1, tg->td->throtl_slice); > > /* > * jiffy_elapsed_rnd should not be a big value as minimum iops can be Did you use a tiny iops limit to run into this? thanks, -liubo