Received: by 10.213.65.68 with SMTP id h4csp1768595imn; Mon, 19 Mar 2018 12:44:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELuCzZexVkf+iWLRJiS2VPLawPTPor6EDyPtM34/HQ20s5gvXiSYWXe6rSRSTv9n2yGCo4ls X-Received: by 10.99.107.72 with SMTP id g69mr9913753pgc.337.1521488673744; Mon, 19 Mar 2018 12:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521488673; cv=none; d=google.com; s=arc-20160816; b=HdL3R58karOYkfsZ0CP5z5ydcTEix1fSoQ/zHWd5z4U8aaC12F6QcoHzH0h2TPzSz0 p6mfEeLmt9Wc7wmF3Ii2Zw0UZRmj/j01FZtRHpFdvqHat/DRvBtbUXc03r3Wwnxx1c3t +Rb3GhVExd+zkt1nreHY2fK7eBJCU9lPXGQiSuU+28NLQZssqqS02lBll22/UzhmGLrh /2aGoOn7+9ksukrlEIBCBH3N9J2595RrL61CxZkMO68UTBR+1kzWoAXuhQkaurGQywAk 5/0PKgzEy7WDjn4vmQjDA3v0xQuFqxVlrxyh0zLoM2UidXPP0Sl99H2qKx+BoaYXr0zZ 8DAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GtgNd+4slKMTPKoT9FJZWRtLnoAPYWFmuwBe3ouSFM0=; b=wLy9KJ2uMZkHuM6vwLPyY6HycG8VgB5ZcTwBIsLG5Y5+AxsF2lC4/Lso7oeygMxZE0 EthIjbdVVamtL3rnAATN3XywOsMN9/WB1lt4vJy/EyOtikKctDVCl/xCr/SNGZfgnlnq qSXxwhdFeG9xeyz3gNg/Orh4fxP/CCX38iuzfsr3GfKpTn6tQo0pQK2YFU/AgcVo1fo6 CAeIeX4qCNLANnzpeErnUmGzMdhFhfyf//tH9wylk/ma/clOMoygRf1KLcPjtxI2DxsX e4Qvkbp8CY4xSjjPAB28AK7jnS1Jp/B+brLldhwpwh/UzE2KBetUAG/5qzeIzztJb2UF X5pw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si452684pfh.60.2018.03.19.12.44.18; Mon, 19 Mar 2018 12:44:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031111AbeCSSVW (ORCPT + 99 others); Mon, 19 Mar 2018 14:21:22 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48048 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031100AbeCSSVU (ORCPT ); Mon, 19 Mar 2018 14:21:20 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 87B201258; Mon, 19 Mar 2018 18:21:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaohua Li , Jens Axboe , Sasha Levin Subject: [PATCH 4.9 078/241] blk-throttle: make sure expire time isnt too big Date: Mon, 19 Mar 2018 19:05:43 +0100 Message-Id: <20180319180754.432758367@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shaohua Li [ Upstream commit 06cceedcca67a93ac7f7aa93bbd9980c7496d14e ] cgroup could be throttled to a limit but when all cgroups cross high limit, queue enters a higher state and so the group should be throttled to a higher limit. It's possible the cgroup is sleeping because of throttle and other cgroups don't dispatch IO any more. In this case, nobody can trigger current downgrade/upgrade logic. To fix this issue, we could either set up a timer to wakeup the cgroup if other cgroups are idle or make sure this cgroup doesn't sleep too long. Setting up a timer means we must change the timer very frequently. This patch chooses the latter. Making cgroup sleep time not too big wouldn't change cgroup bps/iops, but could make it wakeup more frequently, which isn't a big issue because throtl_slice * 8 is already quite big. Signed-off-by: Shaohua Li Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- block/blk-throttle.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -499,6 +499,17 @@ static void throtl_dequeue_tg(struct thr static void throtl_schedule_pending_timer(struct throtl_service_queue *sq, unsigned long expires) { + unsigned long max_expire = jiffies + 8 * throtl_slice; + + /* + * Since we are adjusting the throttle limit dynamically, the sleep + * time calculated according to previous limit might be invalid. It's + * possible the cgroup sleep time is very long and no other cgroups + * have IO running so notify the limit changes. Make sure the cgroup + * doesn't sleep too long to avoid the missed notification. + */ + if (time_after(expires, max_expire)) + expires = max_expire; mod_timer(&sq->pending_timer, expires); throtl_log(sq, "schedule timer. delay=%lu jiffies=%lu", expires - jiffies, jiffies);