[Devel] [PATCH RHEL7 COMMIT] ub: ressurrect ioprio_set IOPRIO_WHO_UBC

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 16 05:28:46 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.13
------>
commit e388650feb976641e0ab2d62ec1c789f7facf5d9
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Tue Jun 16 16:28:46 2015 +0400

    ub: ressurrect ioprio_set IOPRIO_WHO_UBC
    
    Patchset description:
    
    https://jira.sw.ru/browse/PSBM-34007
    
    Vladimir Davydov (7):
      ioprio: move IOPRIO_WHO_UBC handling out of rcu section
      ub: zap ub_{init,fini}_ioprio
      ub: export ub_get_{mem,blkio}_css
      ub: ressurrect ioprio_set IOPRIO_WHO_UBC
      ub: ressurrect iostat and ioprio reporting
      ub: account writeback io
      ub: do not include block/blk-cgroup.h from io_prio.c
    
    This patch description:
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Acked-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 block/cfq-iosched.c |  7 +++++++
 kernel/bc/io_prio.c | 19 +++++++++----------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c649678..b4a9ff7 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1739,6 +1739,13 @@ static int cfq_set_leaf_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
 	return __cfq_set_weight(cgrp, cft, val, true);
 }
 
+#ifdef CONFIG_BC_IO_PRIORITY
+int blkcg_set_weight(struct cgroup *cgrp, unsigned int weight)
+{
+	return cfq_set_weight(cgrp, NULL, weight);
+}
+#endif
+
 static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft,
 			   struct seq_file *sf)
 {
diff --git a/kernel/bc/io_prio.c b/kernel/bc/io_prio.c
index f51553c..6d31ce9 100644
--- a/kernel/bc/io_prio.c
+++ b/kernel/bc/io_prio.c
@@ -14,11 +14,16 @@
 #include <bc/proc.h>
 #include "blk-cgroup.h"
 
-//static u64 ioprio_weight[UB_IOPRIO_MAX] = {320, 365, 410, 460, 500, 550, 600, 640};
+static unsigned int ioprio_weight[UB_IOPRIO_MAX] = {
+	320, 365, 410, 460, 500, 550, 600, 640,
+};
+
+extern int blkcg_set_weight(struct cgroup *cgrp, unsigned int weight);
 
 int ub_set_ioprio(int id, int ioprio)
 {
 	struct user_beancounter *ub;
+	struct cgroup_subsys_state *css;
 	int ret;
 
 	ret = -ERANGE;
@@ -30,15 +35,9 @@ int ub_set_ioprio(int id, int ioprio)
 	if (!ub)
 		goto out;
 
-	ret = 0;
-#if 0
-	if (ub->blkio_cgroup)
-//		ret = blkio_cgroup_set_weight(ub->blkio_cgroup,
-//				ioprio_weight[ioprio])
-		ret = 0;
-	else
-		ret = -ENOTSUPP;
-#endif
+	css = ub_get_blkio_css(ub);
+	ret = blkcg_set_weight(css->cgroup, ioprio_weight[ioprio]);
+	css_put(css);
 	put_beancounter(ub);
 out:
 	return ret;



More information about the Devel mailing list