aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Safonov <dima@arista.com>2019-11-12 01:27:07 +0000
committerThomas Gleixner <tglx@linutronix.de>2020-01-14 12:20:56 +0100
commit0efc8bb0bb5fdfd529a23073ee15478b5d5e3839 (patch)
treeda937756dafd0e1c13aa37a9ebc883cdfd295e55
parentposix-timers: Make clock_nanosleep() time namespace aware (diff)
downloadlinux-dev-0efc8bb0bb5fdfd529a23073ee15478b5d5e3839.tar.xz
linux-dev-0efc8bb0bb5fdfd529a23073ee15478b5d5e3839.zip
fs/proc: Respect boottime inside time namespace for /proc/uptime
Make sure that /proc/uptime is adjusted to the tasks time namespace. Co-developed-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20191112012724.250792-19-dima@arista.com
-rw-r--r--fs/proc/uptime.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
index a4c2791ab70b..5a1b228964fb 100644
--- a/fs/proc/uptime.c
+++ b/fs/proc/uptime.c
@@ -5,6 +5,7 @@
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/time.h>
+#include <linux/time_namespace.h>
#include <linux/kernel_stat.h>
static int uptime_proc_show(struct seq_file *m, void *v)
@@ -20,6 +21,8 @@ static int uptime_proc_show(struct seq_file *m, void *v)
nsec += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE];
ktime_get_boottime_ts64(&uptime);
+ timens_add_boottime(&uptime);
+
idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
idle.tv_nsec = rem;
seq_printf(m, "%lu.%02lu %lu.%02lu\n",