[Devel] [PATCH VZ10 1/2] ve: move cgroup_mark_ve_roots before	kernel thread creation
    Pavel Tikhomirov 
    ptikhomirov at virtuozzo.com
       
    Mon Sep 29 08:13:55 MSK 2025
    
    
  
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>
---
 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);
-- 
2.51.0
    
    
More information about the Devel
mailing list