[RH7] ve/sysinfo: don't clean uptime, procs and loads in containers

Submitted by Pavel Tikhomirov on Oct. 30, 2017, 1:47 p.m.

Details

Message ID 20171030134744.29959-1-ptikhomirov@virtuozzo.com
State New
Series "ve/sysinfo: don't clean uptime, procs and loads in containers"
Headers show

Commit Message

Pavel Tikhomirov Oct. 30, 2017, 1:47 p.m.
Have diff-ve-sysinfo-dont-clean-uptime-procs-and-loads-in-containers
in rh6, but in rh7 we moved only si_meminfo(info);\nsi_swapinfo(info);
part, so also move virtinfo_notifier_call part.

Note: bc_fill_sysinfo() does not clear sysinfo for ve0.

rh6 commit message:
Subject: fix sysinfo in containers: don't clean uptime, procs and loads
Date: Fri, 27 Apr 2012 19:37:14 +0400

virtinfo_notifier_call calls bc_fill_sysinfo, which stores for later
calculations totalram and totalswap and then clears entire
sysinfo structure.

Let's fill uptime, procs and loads after call virtinfo_notifier_call.

Fix for http://bugzilla.openvz.org/show_bug.cgi?id=2051

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>

https://jira.sw.ru/browse/PSBM-62094
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 kernel/sys.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/kernel/sys.c b/kernel/sys.c
index f21cf8ef95f0..aab63ee4a0a5 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2773,6 +2773,11 @@  static int do_sysinfo(struct sysinfo *info)
 	si_meminfo(info);
 	si_swapinfo(info);
 
+#ifdef CONFIG_BEANCOUNTERS
+	if (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_SYSINFO, info)
+			& NOTIFY_FAIL)
+		return -ENOMSG;
+#endif
 	ve = get_exec_env();
 
 	get_monotonic_boottime(&tp);
@@ -2790,11 +2795,6 @@  static int do_sysinfo(struct sysinfo *info)
 		get_avenrun_ve(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
 	}
 
-#ifdef CONFIG_BEANCOUNTERS
-	if (virtinfo_notifier_call(VITYPE_GENERAL, VIRTINFO_SYSINFO, info)
-			& NOTIFY_FAIL)
-		return -ENOMSG;
-#endif
 	/*
 	 * If the sum of all the available memory (i.e. ram + swap)
 	 * is less than can be stored in a 32 bit unsigned long then