From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Fri, 21 Aug 2026 18:42:14 +0200 Subject: [Devel] [PATCH RHEL10 COMMIT] mm/shmem: build the tmpfs size virtualization only with CONFIG_VE In-Reply-To: <20260821163718.187766-13-khorenko@virtuozzo.com> Message-ID: <202608211642.67LGgEEr667257@f0.sw.ru> List-Id: The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-211.39.1.16.6.vz10 ------> commit 064d8fb3a0c7699ef5f0a0ff21dc86bfa60553dc Author: Konstantin Khorenko Date: Fri Aug 21 18:36:58 2026 +0200 mm/shmem: build the tmpfs size virtualization only with CONFIG_VE tmpfs_ram_pages() sizes a Container's default tmpfs mounts against the Container's memory cgroup limit, looking the cgroup up by memory_cgrp_id and reading memcg->memory.max. The function is compiled whenever CONFIG_TMPFS is set, so with CONFIG_MEMCG=n - which CONFIG_VE=n allows, and plain "make defconfig" used to produce - the build fails: mm/shmem.c: error: 'memory_cgrp_id' undeclared (first use in this function) mm/shmem.c: error: invalid use of undefined type 'struct mem_cgroup' CONFIG_VE selects CONFIG_MEMCG, so compile the Container branch under CONFIG_VE and keep the host branch, which already returns totalram_pages(), as the only remaining path. Fixes: e38fda88c26d ("shmem/ve: virtualize tmpfs default size") Feature: fs: tmpfs virtualization https://virtuozzo.atlassian.net/browse/VSTOR-134732 Signed-off-by: Konstantin Khorenko --- mm/shmem.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index a86564c6637e5..522322d4f3599 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -143,20 +143,23 @@ static bool shmem_orders_configured __initdata; #ifdef CONFIG_TMPFS static unsigned long tmpfs_ram_pages(void) { +#ifdef CONFIG_VE struct ve_struct *ve = get_exec_env(); - struct cgroup_subsys_state *css; - unsigned long ve_ram_pages; - struct mem_cgroup *memcg; - if (ve_is_super(ve)) - return totalram_pages(); + if (!ve_is_super(ve)) { + struct cgroup_subsys_state *css; + unsigned long ve_ram_pages; + struct mem_cgroup *memcg; - css = ve_get_init_css(ve, memory_cgrp_id); - memcg = mem_cgroup_from_css(css); - ve_ram_pages = min(totalram_pages(), memcg->memory.max); - css_put(css); + css = ve_get_init_css(ve, memory_cgrp_id); + memcg = mem_cgroup_from_css(css); + ve_ram_pages = min(totalram_pages(), memcg->memory.max); + css_put(css); - return ve_ram_pages; + return ve_ram_pages; + } +#endif + return totalram_pages(); } static unsigned long shmem_default_max_blocks(void)