[Devel] [PATCH 2/2 RH8] mm/backing-dev: associate writeback with correct blkcg

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Tue Jul 6 20:53:31 MSK 2021


Use cgroup_get_e_ve_css to get correct blkcg_css for writeback instances.

https://jira.sw.ru/browse/PSBM-131253
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 mm/backing-dev.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index cc2a3c0..f6884ab 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -559,7 +559,17 @@ static int cgwb_create(struct backing_dev_info *bdi,
 	int ret = 0;
 
 	memcg = mem_cgroup_from_css(memcg_css);
+
+#ifdef CONFIG_VE
+	if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
+		blkcg_css = cgroup_get_e_css(memcg_css->cgroup,
+					     &io_cgrp_subsys);
+	else
+		blkcg_css = cgroup_get_e_ve_css(memcg_css->cgroup,
+						&io_cgrp_subsys);
+#else
 	blkcg_css = cgroup_get_e_css(memcg_css->cgroup, &io_cgrp_subsys);
+#endif
 	blkcg = css_to_blkcg(blkcg_css);
 	memcg_cgwb_list = &memcg->cgwb_list;
 	blkcg_cgwb_list = &blkcg->cgwb_list;
@@ -683,8 +693,17 @@ struct bdi_writeback *wb_get_create(struct backing_dev_info *bdi,
 			struct cgroup_subsys_state *blkcg_css;
 
 			/* see whether the blkcg association has changed */
+#ifdef CONFIG_VE
+			if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
+				blkcg_css = cgroup_get_e_css(memcg_css->cgroup,
+							     &io_cgrp_subsys);
+			else
+				blkcg_css = cgroup_get_e_ve_css(memcg_css->cgroup,
+							     &io_cgrp_subsys);
+#else
 			blkcg_css = cgroup_get_e_css(memcg_css->cgroup,
 						     &io_cgrp_subsys);
+#endif
 			if (unlikely(wb->blkcg_css != blkcg_css ||
 				     !wb_tryget(wb)))
 				wb = NULL;
-- 
1.8.3.1



More information about the Devel mailing list