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


Groups > linux.kernel > #1522140

[PATCH V4 11/15] blk-throttle: add interface to configure think time threshold

From Shaohua Li <shli@fb.com>
Newsgroups linux.kernel
Subject [PATCH V4 11/15] blk-throttle: add interface to configure think time threshold
Date 2016-11-14 23:30 +0100
Message-ID <sDxVg-4Bm-33@gated-at.bofh.it> (permalink)
References <sDxVf-4Bm-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add interface to configure the threshold

Signed-off-by: Shaohua Li <shli@fb.com>
---
 block/blk-sysfs.c    |  7 +++++++
 block/blk-throttle.c | 25 +++++++++++++++++++++++++
 block/blk.h          |  4 ++++
 3 files changed, 36 insertions(+)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 3e284e4..f15aeed 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -532,6 +532,12 @@ static struct queue_sysfs_entry throtl_slice_entry = {
 	.show = blk_throtl_slice_show,
 	.store = blk_throtl_slice_store,
 };
+
+static struct queue_sysfs_entry throtl_idle_threshold_entry = {
+	.attr = {.name = "throttling_idle_threshold", .mode = S_IRUGO | S_IWUSR },
+	.show = blk_throtl_idle_threshold_show,
+	.store = blk_throtl_idle_threshold_store,
+};
 #endif
 
 static struct attribute *default_attrs[] = {
@@ -563,6 +569,7 @@ static struct attribute *default_attrs[] = {
 	&queue_dax_entry.attr,
 #ifdef CONFIG_BLK_DEV_THROTTLING
 	&throtl_slice_entry.attr,
+	&throtl_idle_threshold_entry.attr,
 #endif
 	NULL,
 };
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index cb5fd85..e403e88 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -2139,6 +2139,31 @@ ssize_t blk_throtl_slice_store(struct request_queue *q,
 	return count;
 }
 
+ssize_t blk_throtl_idle_threshold_show(struct request_queue *q, char *page)
+{
+	u64 threshold = q->td->idle_ttime_threshold;
+
+	if (!q->td)
+		return -EINVAL;
+	do_div(threshold, 1000);
+	return sprintf(page, "%lluus\n", threshold);
+}
+
+ssize_t blk_throtl_idle_threshold_store(struct request_queue *q,
+	const char *page, size_t count)
+{
+	unsigned long v;
+
+	if (!q->td)
+		return -EINVAL;
+	if (kstrtoul(page, 10, &v))
+		return -EINVAL;
+	if (v == 0)
+		return -EINVAL;
+	q->td->idle_ttime_threshold = v * 1000;
+	return count;
+}
+
 static int __init throtl_init(void)
 {
 	kthrotld_workqueue = alloc_workqueue("kthrotld", WQ_MEM_RECLAIM, 0);
diff --git a/block/blk.h b/block/blk.h
index b433f35..2ebde12 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -292,6 +292,10 @@ extern void blk_throtl_exit(struct request_queue *q);
 extern ssize_t blk_throtl_slice_show(struct request_queue *q, char *page);
 extern ssize_t blk_throtl_slice_store(struct request_queue *q,
 	const char *page, size_t count);
+extern ssize_t blk_throtl_idle_threshold_show(struct request_queue *q,
+	char *page);
+extern ssize_t blk_throtl_idle_threshold_store(struct request_queue *q,
+	const char *page, size_t count);
 extern void blk_throtl_bio_endio(struct bio *bio);
 #else /* CONFIG_BLK_DEV_THROTTLING */
 static inline void blk_throtl_drain(struct request_queue *q) { }
-- 
2.9.3

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


Thread

[PATCH V4 00/15] blk-throttle: add .high limit Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
  [PATCH V4 09/15] blk-throttle: make bandwidth change smooth Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
    Re: [PATCH V4 09/15] blk-throttle: make bandwidth change smooth Tejun Heo <tj@kernel.org> - 2016-11-23 22:30 +0100
  [PATCH V4 11/15] blk-throttle: add interface to configure think time threshold Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
    Re: [PATCH V4 11/15] blk-throttle: add interface to configure think  time threshold Tejun Heo <tj@kernel.org> - 2016-11-23 22:40 +0100
  [PATCH V4 03/15] blk-throttle: configure bps/iops limit for cgroup in high limit Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
    Re: [PATCH V4 03/15] blk-throttle: configure bps/iops limit for  cgroup in high limit Tejun Heo <tj@kernel.org> - 2016-11-22 21:20 +0100
  [PATCH V4 01/15] blk-throttle: prepare support multiple limits Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
  [PATCH V4 15/15] blk-throttle: add latency target support Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
  [PATCH V4 13/15] blk-throttle: add a mechanism to estimate IO latency Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
  [PATCH V4 02/15] blk-throttle: add .high interface Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100
    Re: [PATCH V4 02/15] blk-throttle: add .high interface Tejun Heo <tj@kernel.org> - 2016-11-22 21:10 +0100
      Re: [PATCH V4 02/15] blk-throttle: add .high interface Tejun Heo <tj@kernel.org> - 2016-11-23 22:20 +0100
  [PATCH V4 08/15] blk-throttle: detect completed idle cgroup Shaohua Li <shli@fb.com> - 2016-11-14 23:30 +0100

csiph-web