[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2087cf9b-89a1-e591-4dcd-4d98767a1be6@redhat.com>
Date: Fri, 28 Sep 2018 20:20:10 +0200
From: Laurent Vivier <lvivier@...hat.com>
To: Dmitry Safonov <dima@...sta.com>, linux-kernel@...r.kernel.org
Cc: Dmitry Safonov <0x7f454c46@...il.com>,
Andrei Vagin <avagin@...nvz.org>,
Adrian Reber <adrian@...as.de>,
Andy Lutomirski <luto@...nel.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Jeff Dike <jdike@...toit.com>, Oleg Nesterov <oleg@...hat.com>,
Pavel Emelyanov <xemul@...tuozzo.com>,
Shuah Khan <shuah@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
containers@...ts.linux-foundation.org, criu@...nvz.org,
linux-api@...r.kernel.org, x86@...nel.org
Subject: Re: [RFC 01/20] ns: Introduce Time Namespace
On 19/09/2018 22:50, Dmitry Safonov wrote:
> From: Andrei Vagin <avagin@...nvz.org>
>
> Time Namespace isolates clock values.
>
> The kernel provides access to several clocks CLOCK_REALTIME,
> CLOCK_MONOTONIC, CLOCK_BOOTTIME, etc.
>
> CLOCK_REALTIME
> System-wide clock that measures real (i.e., wall-clock) time.
>
> CLOCK_MONOTONIC
> Clock that cannot be set and represents monotonic time since
> some unspecified starting point.
>
> CLOCK_BOOTTIME
> Identical to CLOCK_MONOTONIC, except it also includes any time
> that the system is suspended.
>
> For many users, the time namespace means the ability to changes time in
> a container (CLOCK_REALTIME).
>
> But in a context of the checkpoint/restore functionality, monotonic and
> bootime clocks become interesting. Both clocks are monotonic with
> unspecified staring points. These clocks are widely used to measure time
> slices, set timers. After restoring or migrating processes, we have to
> guarantee that they never go backward. In an ideal case, the behavior of
> these clocks should be the same as for a case when a whole system is
> suspended. All this means that we need to be able to set CLOCK_MONOTONIC
> and CLOCK_BOOTTIME clocks, what can be done by adding per-namespace
> offsets for clocks.
>
> Link: https://criu.org/Time_namespace
> Link: https://lists.openvz.org/pipermail/criu/2018-June/041504.html
> Signed-off-by: Andrei Vagin <avagin@...nvz.org>
> Co-developed-by: Dmitry Safonov <dima@...sta.com>
> Signed-off-by: Dmitry Safonov <dima@...sta.com>
> ---
> fs/proc/namespaces.c | 3 +
> include/linux/nsproxy.h | 1 +
> include/linux/proc_ns.h | 1 +
> include/linux/time_namespace.h | 59 ++++++++++++++
> include/linux/user_namespace.h | 1 +
> include/uapi/linux/sched.h | 1 +
> init/Kconfig | 7 ++
> kernel/Makefile | 1 +
> kernel/fork.c | 3 +-
> kernel/nsproxy.c | 19 ++++-
> kernel/time_namespace.c | 169 +++++++++++++++++++++++++++++++++++++++++
> 11 files changed, 262 insertions(+), 3 deletions(-)
> create mode 100644 include/linux/time_namespace.h
> create mode 100644 kernel/time_namespace.c
>
...
> diff --git a/kernel/time_namespace.c b/kernel/time_namespace.c
> new file mode 100644
> index 000000000000..902cd9c22159
> --- /dev/null
> +++ b/kernel/time_namespace.c
...
> +
> +struct time_namespace init_time_ns = {
> + .kref = KREF_INIT(2),
> + .user_ns = &init_user_ns,
> + .ns.inum = PROC_UTS_INIT_INO,
Do you mean PROC_TIME_INIT_INO?
> +#ifdef CONFIG_UTS_NS
> + .ns.ops = &timens_operations,
> +#endif
Do you mean CONFIG_TIME_NS?
Thanks,
Laurent
Powered by blists - more mailing lists