[Devel] [PATCH RHEL7 COMMIT] ub stat: sync memcg contents with beancounter if required
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Oct 8 04:53:23 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.4
------>
commit 272091e4e1a76f9361feae7a1955774e4665a80b
Author: Stanislav Kinsburskiy <skinsbursky at parallels.com>
Date: Thu Oct 8 15:53:23 2015 +0400
ub stat: sync memcg contents with beancounter if required
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at parallels.com>
---
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:
More information about the Devel
mailing list