On 07/10/2020 02:24 PM, Konstantin Khorenko wrote:
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.

It's decided to keep the current behavior, i.e.
don't show more RAM and SWAP available in a Container even in case
Container's config contains BIG values for this parameters.

So dropping this patch.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team


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 <[email protected]>
---
 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);


_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to