[Devel] [PATCH VZ10 v2 02/12] ve: Enable files on cgroup-v2
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Wed Dec 10 13:34:23 MSK 2025
All ve_cftypes and also sysfs_ve_cftypes. Now ve controller can be
enabled on default hierarchy via cgroup.subtree_controll and will show
those files.
https://virtuozzo.atlassian.net/browse/VSTOR-119804
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Feature: ve: ve generic structures
---
fs/sysfs/ve.c | 2 +-
include/linux/cgroup.h | 1 +
kernel/cgroup/cgroup.c | 2 +-
kernel/ve/ve.c | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/sysfs/ve.c b/fs/sysfs/ve.c
index 9ddabac94c2f..eb941a1d5dd5 100644
--- a/fs/sysfs/ve.c
+++ b/fs/sysfs/ve.c
@@ -103,6 +103,6 @@ static struct cftype sysfs_ve_cftypes[] = {
static int init_sysfve_perms(void)
{
- return cgroup_add_legacy_cftypes(&ve_cgrp_subsys, sysfs_ve_cftypes);
+ return cgroup_add_cftypes(&ve_cgrp_subsys, sysfs_ve_cftypes);
}
module_init(init_sysfve_perms);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 6fe5422e27b9..204b62914495 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -111,6 +111,7 @@ struct cgroup *cgroup_v1v2_get_from_fd(int fd);
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
+int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
int cgroup_rm_cftypes(struct cftype *cfts);
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 753721edb642..d6a762398ea5 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5072,7 +5072,7 @@ int cgroup_rm_cftypes(struct cftype *cfts)
* function currently returns 0 as long as @cfts registration is successful
* even if some file creation attempts on existing cgroups fail.
*/
-static int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
+int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
{
int ret;
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index e66ba6fe1a63..84e23b7e61ee 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1906,6 +1906,7 @@ struct cgroup_subsys ve_cgrp_subsys = {
.can_attach = ve_can_attach,
.attach = ve_attach,
.legacy_cftypes = ve_cftypes,
+ .dfl_cftypes = ve_cftypes,
};
static int __init ve_subsys_init(void)
--
2.52.0
More information about the Devel
mailing list