4.14: remove beancounter cgroup usage

Submitted by Stanislav Kinsburskiy on Jan. 9, 2018, 10:11 a.m.

Details

Message ID 20180109101151.9972.23264.stgit@skinsbursky-vz7.qa.sw.ru
State New
Series "4.14: remove beancounter cgroup usage"
Headers show

Commit Message

Stanislav Kinsburskiy Jan. 9, 2018, 10:11 a.m.
This might be a temporary patch (since we don't have beaconters in 4.14 yet),
but it's needed to proceed with testing.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 lib/cgroup.c    |   30 +-----------------------------
 lib/cgroup.h    |    1 -
 lib/env_nsops.c |   38 ++------------------------------------
 3 files changed, 3 insertions(+), 66 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/cgroup.c b/lib/cgroup.c
index cd71064..52dc013 100644
--- a/lib/cgroup.c
+++ b/lib/cgroup.c
@@ -56,7 +56,6 @@  static struct cg_ctl cg_ctl_map[] = {
 	{CG_DEVICES},
 	{CG_BLKIO},
 	{CG_FREEZER},
-	{CG_UB, 1},
 	{CG_VE, 1},
 	{CG_PERF_EVENT},
 	{CG_HUGETLB},
@@ -741,39 +740,12 @@  int cg_env_set_memory(const char *ctid, const char *name, unsigned long value)
 
 int cg_env_set_ub(const char *ctid, const char *name, unsigned long b, unsigned long l)
 {
-	int rc;
-	char _name[STR_SIZE];
-
-	snprintf(_name, sizeof(_name), "beancounter.%s.barrier", name);
-	rc = cg_set_ul(ctid, CG_UB, _name, b);
-	if (rc)
-		return rc;
-
-	snprintf(_name, sizeof(_name), "beancounter.%s.limit", name);
-	return cg_set_ul(ctid, CG_UB, _name, l);
+	return 0;
 }
 
 static int cg_env_set_io(const char *ctid, const char *name, unsigned int speed,
 		unsigned int burst, unsigned int latency)
 {
-	int ret;
-	char buf[STR_SIZE];
-
-	snprintf(buf, sizeof(buf), CG_UB".%s.speed", name);
-	ret = cg_set_ul(ctid, CG_UB, buf, speed);
-	if (ret)
-		return ret;
-
-	snprintf(buf, sizeof(buf), CG_UB".%s.burst", name);
-	ret = cg_set_ul(ctid, CG_UB, buf, burst);
-	if (ret)
-		return ret;
-
-	snprintf(buf, sizeof(buf), CG_UB".%s.latency", name);
-	ret = cg_set_ul(ctid, CG_UB, buf, latency);
-	if (ret)
-		return ret;
-
 	return 0;
 }
 
diff --git a/lib/cgroup.h b/lib/cgroup.h
index 53429e9..c0b308d 100644
--- a/lib/cgroup.h
+++ b/lib/cgroup.h
@@ -29,7 +29,6 @@ 
 #define CG_MEMORY	"memory"
 #define CG_NET_CLS	"net_cls"
 #define CG_VE		"ve"
-#define CG_UB		"beancounter"
 #define CG_BLKIO	"blkio"
 #define CG_FREEZER	"freezer"
 #define CG_PERF_EVENT	"perf_event"
diff --git a/lib/env_nsops.c b/lib/env_nsops.c
index a30eb6a..13e65b0 100644
--- a/lib/env_nsops.c
+++ b/lib/env_nsops.c
@@ -566,24 +566,12 @@  static int init_env_cgroup(struct vzctl_env_handle *h, int flags)
 		"cpuset.cpus",
 		"cpuset.mems"
 	};
-	char *bc[] = {
-		"beancounter.memory",
-		"beancounter.blkio"
-	};
 
 	logger(10, 0, "* init Container cgroup");
 	if (h->veid && cg_set_veid(EID(h), h->veid) == -1)
 		return vzctl_err(VZCTL_E_RESOURCE, 0,
 				"Failed to set VEID=%u", h->veid);
 
-	/* Bind beancounter with blkio/memory cgroups */
-	for (i = 0; i < sizeof(bc)/sizeof(bc[0]); i++) {
-		snprintf(buf, sizeof(buf), "/%s/%s", cg_get_slice_name(), EID(h));
-		ret = cg_set_param(EID(h), CG_UB, bc[i], buf);
-		if (ret)
-			return ret;
-	}
-
 	ret = cg_env_set_memory(h->ctid, "memory.use_hierarchy", 1);
 	if (ret)
 		return ret;
@@ -1674,14 +1662,7 @@  static int ns_set_iolimit(struct vzctl_env_handle *h, unsigned int speed)
 
 static int ns_get_iolimit(struct vzctl_env_handle *h, unsigned int *speed)
 {
-	int ret;
-	unsigned long n;
-
-	ret = cg_get_ul(EID(h), CG_UB, CG_UB".iolimit.speed", &n);
-
-	*speed = (unsigned int) n;
-
-	return ret;
+	return 0;
 }
 
 static int ns_set_ioprio(struct vzctl_env_handle *h, int prio)
@@ -1712,13 +1693,7 @@  static int ns_set_iopslimit(struct vzctl_env_handle *h, unsigned int speed)
 
 static int ns_get_iopslimit(struct vzctl_env_handle *h, unsigned int *speed)
 {
-	int ret;
-	unsigned long n;
-
-	ret = cg_get_ul(EID(h), CG_UB, CG_UB".iopslimit.speed", &n);
-	*speed = (unsigned int) n;
-
-	return ret;
+	return 0;
 }
 
 static int ns_get_runtime_param(struct vzctl_env_handle *h, int flags)
@@ -1761,11 +1736,6 @@  int vzctl2_set_limits(struct vzctl_env_handle *h, int release)
 {
 	int ret;
 
-	if (release) {
-		cg_set_ul("", CG_UB, "tasks", getpid());
-		return cg_destroy_cgroup(EID(h));
-	}
-
 	if (EMPTY_CTID(h->ctid))
 		vzctl2_generate_ctid(EID(h));
 
@@ -1786,10 +1756,6 @@  int vzctl2_set_limits(struct vzctl_env_handle *h, int release)
 			if (ret)
 				goto err;
 		}
-
-		ret = cg_set_ul(EID(h), CG_UB, "tasks", getpid());
-		if (ret)
-			goto err;
 	}
 
 	return 0;