From: Stanislav Kinsburskiy <[email protected]>

Signed-off-by: Stanislav Kinsburskiy <[email protected]>
---
 kernel/bc/statd.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/kernel/bc/statd.c b/kernel/bc/statd.c
index db9f294..ad80e7e 100644
--- a/kernel/bc/statd.c
+++ b/kernel/bc/statd.c
@@ -224,6 +224,22 @@ int ubstat_alloc_store(struct user_beancounter *ub)
 }
 EXPORT_SYMBOL(ubstat_alloc_store);
 
+static bool ubstat_need_memcg_sync(long cmd)
+{
+       if (UBSTAT_CMD(cmd) != UBSTAT_READ_ONE)
+               return true;
+
+       switch (UBSTAT_PARMID(cmd)) {
+               case UB_KMEMSIZE:
+               case UB_DCACHESIZE:
+               case UB_PHYSPAGES:
+               case UB_SWAPPAGES:
+               case UB_OOMGUARPAGES:
+                       return true;
+       }
+       return false;
+}
+
 static int ubstat_check_cmd(long cmd)
 {
        switch (UBSTAT_CMD(cmd)) {
@@ -255,6 +271,9 @@ static int ubstat_get_stat(struct user_beancounter *ub, 
long cmd,
        if (retval)
                goto out;
 
+       if (ubstat_need_memcg_sync(cmd))
+               ub_sync_memcg(ub);
+
        spin_lock(&ubs_notify_lock);
        switch (UBSTAT_CMD(cmd)) {
                case UBSTAT_READ_ONE:

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

Reply via email to