[Devel] [PATCH RHEL10 COMMIT] ve: move cgroup_mark_ve_roots before kernel thread creation

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 10 20:04:19 MSK 2025


The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.10.vz10
------>
commit de465a243593afaa2cd801b51738376cbb3c0be8
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Mon Sep 29 13:13:55 2025 +0800

    ve: move cgroup_mark_ve_roots before kernel thread creation
    
    For cgroup-v2 we want to put per-ve kernel threads into subgroup of ve's
    unified cgroup, so it is only logical to move cgroup marking before
    kernel thread creation.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-115868
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    Feature: ve: ve generic structures
---
 kernel/ve/ve.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 146f7922d4856..91128fbfacffd 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -725,6 +725,10 @@ static int ve_start_container(struct ve_struct *ve)
 	if (err)
 		goto err_list;
 
+	err = cgroup_mark_ve_roots(ve);
+	if (err)
+		goto err_mark_ve;
+
 	err = ve_start_kthreadd(ve);
 	if (err)
 		goto err_kthreadd;
@@ -741,10 +745,6 @@ static int ve_start_container(struct ve_struct *ve)
 	if (err < 0)
 		goto err_iterate;
 
-	err = cgroup_mark_ve_roots(ve);
-	if (err)
-		goto err_mark_ve;
-
 	err = ve_release_agent_setup(ve);
 	if (err)
 		goto err_release_agent_setup;
@@ -758,8 +758,6 @@ static int ve_start_container(struct ve_struct *ve)
 	return 0;
 
 err_release_agent_setup:
-	cgroup_unmark_ve_roots(ve);
-err_mark_ve:
 	ve_hook_iterate_fini(VE_SS_CHAIN, ve);
 err_iterate:
 	ve_workqueue_stop(ve);
@@ -768,6 +766,8 @@ static int ve_start_container(struct ve_struct *ve)
 err_umh:
 	ve_stop_kthreadd(ve);
 err_kthreadd:
+	cgroup_unmark_ve_roots(ve);
+err_mark_ve:
 	ve_list_del(ve);
 err_list:
 	ve_set_state(ve, VE_STATE_STOPPED);


More information about the Devel mailing list