[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <151240401439.10164.661741658187634131.stgit@localhost.localdomain>
Date: Mon, 04 Dec 2017 19:13:34 +0300
From: Kirill Tkhai <ktkhai@...tuozzo.com>
To: axboe@...nel.dk, bcrl@...ck.org, viro@...iv.linux.org.uk,
tj@...nel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-aio@...ck.org, oleg@...hat.com,
ktkhai@...tuozzo.com
Subject: [PATCH 5/5] blkcg: Add cgroup file to configure
blkcg::blkg_aio_max_nr
Add a file to configure per-cgroup maximum number of available
aio requests.
Allow write the values, which are less then currently allocated
numbers of requests.
Show numbers of currently allocated and maximum available requests.
Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
---
block/blk-cgroup.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 9cc6e9574946..dc5600ef4523 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -981,12 +981,52 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)
return 0;
}
+#ifdef CONFIG_AIO
+static int blkcg_write_aio_max_nr(struct cgroup_subsys_state *css,
+ struct cftype *cftype, u64 val)
+{
+ struct blkcg *blkg = css_to_blkcg(css);
+ int ret = 0;
+
+ percpu_down_read(&cgroup_threadgroup_rwsem);
+ spin_lock(&aio_nr_lock);
+ if (val >= blkg->blkg_aio_nr)
+ blkg->blkg_aio_max_nr = val;
+ else
+ ret = -EBUSY;
+ spin_unlock(&aio_nr_lock);
+ percpu_up_read(&cgroup_threadgroup_rwsem);
+ return ret;
+}
+
+static int blkcg_show_aio_nrs(struct seq_file *sf, void *v)
+{
+ struct blkcg *blkg = css_to_blkcg(seq_css(sf));
+ unsigned long max_nr, nr;
+
+ spin_lock(&aio_nr_lock);
+ max_nr = blkg->blkg_aio_max_nr;
+ nr = blkg->blkg_aio_nr;
+ spin_unlock(&aio_nr_lock);
+
+ seq_printf(sf, "used=%lu, max=%lu\n", nr, max_nr);
+ return 0;
+}
+#endif /* CONFIG_AIO */
+
static struct cftype blkcg_files[] = {
{
.name = "stat",
.flags = CFTYPE_NOT_ON_ROOT,
.seq_show = blkcg_print_stat,
},
+#ifdef CONFIG_AIO
+ {
+ .name = "aio_nr",
+ .write_u64 = blkcg_write_aio_max_nr,
+ .seq_show = blkcg_show_aio_nrs,
+ },
+#endif
{ } /* terminate */
};
Powered by blists - more mailing lists