[Devel] [PATCH RH7 1/2] memcg, bc/vm_pages.c: allow Container to report lot of total RAM/SWAP
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Jul 16 15:37:16 MSK 2020
We used a Container can be configured some SWAP and RAM and expect the
Container reports those total SWAP/RAM values from its configuration
despite the actual ammount of available SWAP/RAM on the Hardware Node.
This assumption has been broken recently, so resurrect the original
behavior.
Fixes: 770906b27920d ("memcg, bc/vm_pages.c: account some swapped memory
as used in CT in /proc/meminfo")
https://jira.sw.ru/browse/PSBM-105529
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
mm/memcontrol.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c2713cfd99753..8cd925d0b2078 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4659,19 +4659,18 @@ void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg, struct meminfo *mi)
void mem_cgroup_fill_sysinfo(struct mem_cgroup *memcg, struct sysinfo *si)
{
- unsigned long totalram, totalswap;
unsigned long swaped, used;
- totalram = si->totalram;
- totalswap = si->totalswap;
-
memset(si, 0, sizeof(*si));
used = page_counter_read(&memcg->memory);
- si->totalram = min(totalram, memcg->memory.limit);
+ /* CT can report totalram > RAM available on Host */
+ si->totalram = memcg->memory.limit;
- swaped = page_counter_read(&memcg->memsw) - page_counter_read(&memcg->memory);
- si->totalswap = min(totalswap, memcg->memsw.limit - memcg->memory.limit);
+ swaped = page_counter_read(&memcg->memsw) -
+ page_counter_read(&memcg->memory);
+ /* CT can report totalswap > SWAP available on Host */
+ si->totalswap = memcg->memsw.limit - memcg->memory.limit;
used = page_counter_read(&memcg->memory);
--
2.15.1
More information about the Devel
mailing list