From: Dmitry Safonov Date: Tue, 12 Nov 2019 01:27:07 +0000 (+0000) Subject: fs/proc: Respect boottime inside time namespace for /proc/uptime X-Git-Tag: v5.15~4663^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0efc8bb0bb5fdfd529a23073ee15478b5d5e3839;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Andrei Vagin Signed-off-by: Dmitry Safonov Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20191112012724.250792-19-dima@arista.com --- diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index a4c2791..5a1b228 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c @@ -5,6 +5,7 @@ #include #include #include +#include #include 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",