Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1610060

[PATCH V7 08/18] blk-throttle: make sure expire time isn't too big

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Shaohua Li <shli@fb.com>
Newsgroups linux.kernel
Subject [PATCH V7 08/18] blk-throttle: make sure expire time isn't too big
Date Mon, 27 Mar 2017 20:40:01 +0200
Message-ID <tpHIB-3SI-9@gated-at.bofh.it> (permalink)
References <tpH5T-3my-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=Y5x2PD+2XihwJ71INIFvec+TnsnriS3zXtVxrjzc/eI=; b=i6I9Ml3+2fHoqUTEGP5TtalrzYuRfn2Hfm69s5EHiM34JVC+waqUUQ8Z3/WOyHY5/Ip6 v+xNvUf/3oTSdxZKvK0043ZGKJZsbT4IgpHUgt/KxbN60gpt+aePRX2R8nEaOOYlJSnc Uff0qyL+KsqjvPlmzh08FdlfqAYJEemnv3M=
SMTP-Origin-Hostprefix devbig
SMTP-Origin-Hostname devbig638.prn2.facebook.com
SMTP-Origin-Cluster prn2c22
X-Mailer git-send-email 2.9.3
X-Fb-Internal Safe
MIME-Version 1.0
Content-Type text/plain
X-Proofpoint-Spam-Reason safe
X-Fb-Internal Safe
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2017-03-27_16:,, signatures=0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 41
Organization linux.* mail to news gateway
X-Original-Cc <axboe@kernel.dk>, <tj@kernel.org>, Vivek Goyal <vgoyal@redhat.com>, <jmoyer@redhat.com>, <Kernel-team@fb.com>
X-Original-Date Mon, 27 Mar 2017 10:51:36 -0700
X-Original-Message-ID <6bab8d46094d0076e9adda080d80c7ca0b9947f6.1490634565.git.shli@fb.com>
X-Original-References <cover.1490634565.git.shli@fb.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1610060

Show key headers only | View raw


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 <shli@fb.com>
---
 block/blk-throttle.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 7878ec1..2073b48 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -590,6 +590,17 @@ static void throtl_dequeue_tg(struct throtl_grp *tg)
 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);
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V7 00/18] blk-throttle: add .low limit Shaohua Li <shli@fb.com> - 2017-03-27 20:40 +0200
  [PATCH V7 09/18] blk-throttle: make throtl_slice tunable Shaohua Li <shli@fb.com> - 2017-03-27 20:40 +0200
  [PATCH V7 04/18] blk-throttle: add .low interface Shaohua Li <shli@fb.com> - 2017-03-27 20:40 +0200
  [PATCH V7 08/18] blk-throttle: make sure expire time isn't too big Shaohua Li <shli@fb.com> - 2017-03-27 20:40 +0200
  [PATCH V7 07/18] blk-throttle: add downgrade logic Shaohua Li <shli@fb.com> - 2017-03-27 20:40 +0200
  [PATCH V7 03/18] blk-throttle: add configure option for new .low interface Shaohua Li <shli@fb.com> - 2017-03-27 20:50 +0200

csiph-web