[Devel] [PATCH RHEL8 COMMIT] ve/cgroup: Add helper function to get ve-related cgroup paths
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Mar 3 20:21:12 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.5
------>
commit 9228c167b67db7819c5de6b298b16330b1f98178
Author: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
Date: Wed Mar 3 20:21:12 2021 +0300
ve/cgroup: Add helper function to get ve-related cgroup paths
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>
Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
=====================
Patchset description:
ve/cgroup: Port release_agent virtualization from vz7
This patchset ports virtualization of cgroup release_agent
virtualization from vz7.
Major challanges of porting are differences between vz7 and vz8 cgroup
implementations:
- transition of cgroups to kernfs
- slightly changed locking scheme, which relies on css_set_lock in
places, previously relied on cgroup_mutex.
There is a small number of patches that have been ported without
modifications, but most of the patches had suffered a lot of
modification due to the factors described above.
v1:
- original patchset
v2:
- removed port of CGRP_REMOVED due to the use of CSS_ONLINE in VZ8 for
same reason
- changed ve_set(get)_release_agent_path signature for more optimal
- added ve->is_running check before calling userspace executable
v3:
- use goto after check for ve->is_running in last patch
---
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..21a7c36fbf44 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
More information about the Devel
mailing list