[Devel] [VZ10 09/21] ve/cgroup: Fix errors when !CONFIG_VE
Vladimir Riabchun
vladimir.riabchun at virtuozzo.com
Thu May 7 22:10:21 MSK 2026
1. implicit declaration of function: add !CONFIG_VE variant of
ve_hide_cgroups in cgroup.c
2. error: 've_cgrp_id' undeclared: hide usage under CONFIG_VE
3. ./include/linux/umh.h:64:36: error: pasting "(" and "argv"
does not give a valid preprocessing token: fix vararg expansion
4. Unused get_ve result in cgroup_release_agent_write
https://virtuozzo.atlassian.net/browse/VSTOR-130116
Feature: !CONFIG_VE build
Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
---
include/linux/cgroup.h | 2 +-
include/linux/umh.h | 4 ++--
kernel/cgroup/cgroup-v1.c | 2 +-
kernel/cgroup/cgroup.c | 9 +++++++++
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 204b62914495..25a0a053fbed 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -866,8 +866,8 @@ static inline void cgroup_bpf_put(struct cgroup *cgrp) {}
#endif /* CONFIG_CGROUP_BPF */
-#ifdef CONFIG_VE
int ve_hide_cgroups(struct cgroup_root *root);
+#ifdef CONFIG_VE
struct cgroup_subsys_state *cgroup_get_e_ve_css(struct cgroup *cgrp,
struct cgroup_subsys *ss);
#endif
diff --git a/include/linux/umh.h b/include/linux/umh.h
index 35fc4023df74..a71a5e4434fb 100644
--- a/include/linux/umh.h
+++ b/include/linux/umh.h
@@ -61,10 +61,10 @@ extern void wait_khelpers(struct ve_struct *ve);
#else /* CONFIG_VE */
#define call_usermodehelper_ve(ve, ...) \
- call_usermodehelper(##__VA_ARGS__)
+ call_usermodehelper(__VA_ARGS__)
#define call_usermodehelper_exec_ve(ve, ...) \
- call_usermodehelper_exec_ve(##__VA_ARGS__)
+ call_usermodehelper_exec(__VA_ARGS__)
#endif /* CONFIG_VE */
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index dfa9b0c83082..f0009d94f7da 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -586,7 +586,7 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of,
if (root_cgrp == cgrp)
ve = rcu_dereference(root_cgrp->ve_owner);
}
- get_ve(ve);
+ (void) get_ve(ve);
rcu_read_unlock();
if (ve) {
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index e32589e2f305..52cc5db3dcb9 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -328,6 +328,7 @@ bool cgroup_on_dfl(const struct cgroup *cgrp)
return cgrp->root == &cgrp_dfl_root;
}
+#ifdef CONFIG_VE
/*
* The ve returned should be used only while holding rcu_read_lock
*/
@@ -341,6 +342,7 @@ struct ve_struct *cgroup_ve_owner(struct cgroup *cgrp)
ve = rcu_dereference(ve_root->ve_owner);
return ve;
}
+#endif
/* IDR wrappers which synchronize using cgroup_idr_lock */
static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end,
@@ -6434,6 +6436,7 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name,
*/
if (!cgroup_on_dfl(cgrp))
cgrp->subtree_control = cgroup_control(cgrp);
+#ifdef CONFIG_VE
else
/*
* Hide ve controller by default. Note that ve0 cgroup files
@@ -6441,6 +6444,7 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name,
* not created through cgroup_create().
*/
cgrp->hidden_ss_mask = 1 << ve_cgrp_id;
+#endif
cgroup_propagate_control(cgrp);
@@ -6971,6 +6975,11 @@ int ve_hide_cgroups(struct cgroup_root *root)
((root->subsys_mask & hidden_mask) ||
!is_virtualized_cgroot(root));
}
+#else
+int ve_hide_cgroups(struct cgroup_root *root)
+{
+ return 0;
+}
#endif
/*
--
2.43.0
More information about the Devel
mailing list