Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10519048ybi; Thu, 25 Jul 2019 00:47:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPpmiMzT0kDU1km43EfYL3Z6S96DKPfvcorp+mWK9dmVmsn08gbjJBagvE+ufQxZ7UpQ/a X-Received: by 2002:a17:902:e613:: with SMTP id cm19mr83990251plb.299.1564040826226; Thu, 25 Jul 2019 00:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564040826; cv=none; d=google.com; s=arc-20160816; b=mivJ0hfyAbhUboRmoheUE3qbxfnxcL6g02oeFQ89OUpMGubHsoH3ocj1Y6OCvgauYD mPYMgqArdIuY7Nd5nvnhhvD3Ca3h6SzaK+n/0aouG78ujBOHPz9wJoViNTWRzNIeI+nT C+0QTSi2NtIb4ci1arQnxztJrRWhKLyCGisyceHBMWdVwknNqrkg2Bs9pciIFWCeuwE9 6HPEg0q7jEXs/mtCD4B1OxoGcUzbxmaZY5eWWnrgH6CtsXL5TVYtzkDbQUTBigS8iBzy BCmyMi2JcT1+yLj6FinYoqWaeSTm9nico1Rkeb+vIJMcieckCGx8T1TcDpvf2+zC0ErQ amiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9kJFAbhYm5u46lJUu2i89kIUziR0Gc6Gw+Sty4XyqH8=; b=sb5lOlxycw4zalxeHBK20FPLQWHwsAH+JhCW2qjnpPSYDXZww5zLWQ0Ri0V9dQjamK WAGeplPZiKtSCXzxtZII7daVXkvOm2o8nOWaTEpsV8VA/RZbq16OUIuBh83/z8pW1VIB lVZxIMi6r5P6Vj2UzUyrX+U36p5Ulowl+uWjQoh2FhU1be4MtM05AVt9HbDbOz/hzrl1 nc8JH1NDIyfcIYvRa0FEWEQTDHAs1AqGM6dBiAJ9p7WCLlC2gZpUgH3Zjjc8dvWn7VwY qK8ZfZ6khwohPOm+YSaPMHYNGDxqFACuN0GB+Md2uQGy0BsJonblBYOVTrkzbrJaBJT7 TO/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AiteBe3E; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si18954658pgv.577.2019.07.25.00.46.46; Thu, 25 Jul 2019 00:47:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=AiteBe3E; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405267AbfGXUAo (ORCPT + 99 others); Wed, 24 Jul 2019 16:00:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:48756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392090AbfGXUAg (ORCPT ); Wed, 24 Jul 2019 16:00:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A4B4D20665; Wed, 24 Jul 2019 20:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998435; bh=gG5VG+XTA+OvFdThQtGJX+ybh7CaLGuD16nQ0MQYCwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AiteBe3EsEqj8HSo3EBzZ8ot7srsuFnzA6OUFNPqROy0YnE8nee1C6K80iOKGS72b AgdZATnkATteNodVc6LMnEjKYl0wyuLx3IzTjN+GoNysDe6J0E2FIMjJhQupOPosgy TbN4Ihf6qtUinI3lvqKwAakfqFCiKrAFj2Kk9JLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Khlebnikov , Jens Axboe Subject: [PATCH 5.1 364/371] blk-throttle: fix zero wait time for iops throttled group Date: Wed, 24 Jul 2019 21:21:56 +0200 Message-Id: <20190724191751.569452425@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Konstantin Khlebnikov commit 3a10f999ffd464d01c5a05592a15470a3c4bbc36 upstream. 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+ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-throttle.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -881,13 +881,10 @@ static bool tg_with_in_iops_limit(struct unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; u64 tmp; - jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw]; + jiffy_elapsed = 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_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