[Devel] [PATCH VZ8 v0 08/14] cgroup/ve: added cgroup_path_ve_relative function to get ve-related cgroup paths
Valeriy Vdovin
valeriy.vdovin at virtuozzo.com
Tue Jan 19 21:01:48 MSK 2021
This fill make fake-absolute paths to support virtual ve roots in cgroup
hierarchies.
The path will be used in subsequent patches.
Signed-off-by: Valeriy.Vdovin <valeriy.vdovin at virtuozzo.com>
---
kernel/cgroup/cgroup-v1.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index fb06fc9d96ca..c2d59fd926be 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -787,6 +787,16 @@ void cgroup1_check_for_release(struct cgroup *cgrp)
schedule_work(&cgrp->release_agent_work);
}
+/*
+ * Used to get a fake-absolute path to a cgroup on kernfs filesystem, but it
+ * actually be relative to cgroup root, provided in the argument.
+ */
+static inline int cgroup_path_ve_relative(struct cgroup *ve_root_cgrp,
+ struct cgroup *cgrp, char *buf, size_t buflen)
+{
+ return kernfs_path_from_node(cgrp->kn, ve_root_cgrp->kn, buf, buflen);
+}
+
/*
* Notify userspace when a cgroup is released, by running the
* configured release agent with the name of the cgroup (path
--
2.27.0
More information about the Devel
mailing list