[Devel] [PATCH vz8] shmem/ve: Keep host's totalram_pages intact during CT tmpfs default size calculation

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 9 13:54:37 MSK 2021


During tmpfs default size virtualization we occasionally
overwrite 'totalram_pages' global value used for host.

Fix it.

Fixes: b563045c1998 ("shmem/ve: virtualize tmpfs default size")
https://jira.sw.ru/browse/PSBM-130518

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/shmem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 377a038ff24f..e9c8de20440b 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -111,16 +111,17 @@ static unsigned long tmpfs_ram_pages(void)
 {
 	struct ve_struct *ve = get_exec_env();
 	struct cgroup_subsys_state *css;
+	unsigned long ve_ram_pages;
 
 	if (ve_is_super(ve))
 		return totalram_pages;
 
 	css = ve_get_init_css(ve, memory_cgrp_id);
-	totalram_pages = min(totalram_pages,
+	ve_ram_pages = min(totalram_pages,
 			mem_cgroup_total_pages(mem_cgroup_from_css(css)));
 	css_put(css);
 
-	return totalram_pages;
+	return ve_ram_pages;
 }
 
 static unsigned long shmem_default_max_blocks(void)
-- 
2.28.0



More information about the Devel mailing list