The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-693.17.1.vz7.45.4 ------> commit 52d17a28f60d446da2159d486fbbedc197061a91 Author: Kirill Tkhai <ktk...@virtuozzo.com> Date: Tue Feb 27 15:28:28 2018 +0300
ve/cgroup: Get correct VE init css when ve init_task is moved to child cgroup Init task of container can be moved to any child cgroup. But ve_get_init_css() remains to return its cgroup as top of container. Fix that by finding of real top cgroup among init_task cgroup parents. https://jira.sw.ru/browse/PSBM-81572 Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> Reviewed-by: Andrey Ryabinin <aryabi...@virtuozzo.com> ====================================================== Patchset description: sched/ve: Fix wrong loadavg accounting inside CT Three problems are fixed here: 1)Tasks from child task groups are not propagated in CT's loadavg 2)Loadavg of CT's init task cgroup is returned as CT's loadavg, while init task may be in child task group. 3)In calc_load_ve() (from interrupt) we count loadavg for all cpu cgroups, which is slow and unneed. The patchset fixes all of them. https://jira.sw.ru/browse/PSBM-81572 Kirill Tkhai (5): ve/cgroup: Get correct VE init css when ve init_task is moved to child cgroup sched/ve: Link VE root cpu cgroups in separate list sched/ve: Do not show loadavg in child VE cpu cgroups sched/ve: Iterate only VE root cpu cgroups to count loadavg sched/ve: Use cfs_rq::h_nr_running to count loadavg --- kernel/ve/ve.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index ee043483c7e7..68f84797a840 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -111,8 +111,9 @@ EXPORT_SYMBOL(put_ve); struct cgroup_subsys_state *ve_get_init_css(struct ve_struct *ve, int subsys_id) { - struct cgroup_subsys_state *css; + struct cgroup_subsys_state *css, *tmp; struct task_struct *task; + struct cgroup *cgroup; rcu_read_lock(); task = ve->ve_ns ? ve->init_task : &init_task; @@ -122,6 +123,18 @@ struct cgroup_subsys_state *ve_get_init_css(struct ve_struct *ve, int subsys_id) break; cpu_relax(); } + + cgroup = css->cgroup; + while (!test_bit(CGRP_VE_ROOT, &cgroup->flags) && cgroup->parent) + cgroup = cgroup->parent; + + if (cgroup != css->cgroup) { + tmp = cgroup->subsys[subsys_id]; + css_get(tmp); + css_put(css); + css = tmp; + } + rcu_read_unlock(); return css; } _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel