From: Alexander Pavlenko <pavlenko.alexander@huawei.com> hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8422 ---------------------------------------- This commit configures the maximum region size of the xsched dmem root group to match the total physical memory size of the XPU device. By aligning the root group’s max limit with actual hardware capacity, we ensure that child groups cannot collectively exceed the device’s real memory capacity, enabling accurate resource accounting and preventing overcommitment. Signed-off-by: Alexander Pavlenko <pavlenko.alexander@huawei.com> Signed-off-by: Liu Kai <liukai284@huawei.com> --- kernel/cgroup/dmem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/cgroup/dmem.c b/kernel/cgroup/dmem.c index 4cc33e4d8257..31473d9793fe 100644 --- a/kernel/cgroup/dmem.c +++ b/kernel/cgroup/dmem.c @@ -382,6 +382,11 @@ alloc_pool_single(struct dmemcg_state *dmemcs, struct dmem_cgroup_region *region dmemcg_pool_get(ppool); } +#ifdef CONFIG_XCU_SCHEDULER + if (!ppool) + set_resource_max(pool, region->size); +#endif + list_add_tail_rcu(&pool->css_node, &dmemcs->pools); list_add_tail(&pool->region_node, ®ion->pools); -- 2.34.1