Received: by 10.213.65.68 with SMTP id h4csp1793401imn; Mon, 19 Mar 2018 13:25:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELu1gY9TTnOeCwrpz9xeKx5LwaphX2t8pvg6+ru/GWcJz/Z3EEOPAkNAYjaYtBapALq/Qixi X-Received: by 2002:a17:902:bb81:: with SMTP id m1-v6mr13472469pls.71.1521491147908; Mon, 19 Mar 2018 13:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521491147; cv=none; d=google.com; s=arc-20160816; b=AuuxYsaY9aBogJ8c2BJX+t/4YxlX1fHb5j/mwyXIyDqIOrn9DlMcELz/x8s3wpGnAs BXeEpSKDkgxFHtomAb6shhsGd1Nd2dJ12ORsYOgMIMdu2o360+hRfDYa0CM3IcIQoOaB NWpNKl3SEGi/pca64EvuDXVrhPn7Rf1rCSkrW9L2EZ/vgm99vZoRi/fyOqNUnqWJqsgk iHdaP0ypn1aV9Csz8dTu7FCa/eVIysK86GMIhqewtjq/ERqAl39oKRKNV8Lc/hQFsFLL qZUu++dtc25ECo7dZBRop8MtK9420jFzadANBOkmk4ao9DasVCJPELxPQAajzN83fs19 OqbQ== 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=PmAzYEFqfrLkF0kVGPz8ZsxaiqM99BwLrhnhVBJhmZA=; b=FxETpGOUjxDPUxxFhvxYvshwUBiOJn1Fp8YBfR73/0vdRUJoa+IsahQ57XInDeQmF9 qnGeEtmSz2U0irchJO5bzA+5SHyFTy52xtbuWHKGbpDUTBp4gzUmADsuUZM3ajBXqc7P I0AAbktdoaQ1fmuypcXHF49nw9fU9Xc8auJOaYP0WLhKaBcyLQ1SeB2QKno7tYuAGtgO NTaoFkIrbtkKCZS8q0smfwT2lpr6+3ZN24KUiJ49D4O0Khm2i0OS4eSDLv1j0AYwgx2y +Q0nBqf4BG4GJNQJWPIeFmcr2tvqSywEAEFx2XtDqUfxY7lF5Bnp+tyDFp8UwqRzrq6q 2L+w== 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 u12si29429pgb.180.2018.03.19.13.25.33; Mon, 19 Mar 2018 13:25:47 -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 S1031459AbeCSUYI (ORCPT + 99 others); Mon, 19 Mar 2018 16:24:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44014 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030657AbeCSSOK (ORCPT ); Mon, 19 Mar 2018 14:14:10 -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 7D0E488D; Mon, 19 Mar 2018 18:14:09 +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.4 037/134] blk-throttle: make sure expire time isnt too big Date: Mon, 19 Mar 2018 19:05:20 +0100 Message-Id: <20180319171854.688877866@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@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.4-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 @@ -505,6 +505,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);