Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1069583imm; Fri, 28 Sep 2018 11:22:26 -0700 (PDT) X-Google-Smtp-Source: ACcGV60VDeHz868dnX4uBJmSCik8fyUtUwkH8CZCDXNJyX9Uk+oC0/0JCxsbezRGKQeG3ZcZR9gN X-Received: by 2002:a17:902:7b84:: with SMTP id w4-v6mr2653662pll.32.1538158946288; Fri, 28 Sep 2018 11:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538158946; cv=none; d=google.com; s=arc-20160816; b=vt87EkKUeSdjnhbC/nTqDhmakFTmZrajX89RhvW25kdVYx0Svj7cV2Dr49rEo1bvG6 c+N94XN/XEiNEMnt4OMKx6eD0Ty5h7UFFFptzSvbeTyomD/Gc+biiSPsZfi44v6miRFs au4K+iLEJ9z4t+Xrg4atoeE0YmXhkK+onmP4xqGnWwnZe7XYtqjhD/i2qI0A4dpFQWaM 50GQp3VONIKr8fHPV0gOElmUGs6z3hn4hiB93ZWCYQ4FZSxsu8kJ0ThqmPqPNNKYcMWV +fQSrHFb4f6dg+8Rra6mVa821Y0SsWcMR3kc3G9hx0wptJHfvb0JMi+zYtz1uQW2VuRd c50w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:newsgroups:cc:to:subject; bh=vnzhT4XMbRW74Puz3t3lUQM7kvKY7iva7FlEuZHkiLQ=; b=e//7wS/XSO4KrPoM5txePT1MsqX5QuxqsJ3GZSvuUk/4GnWGsvLnWc87oxyrXVDQEK 25A03wTkvW0Pvanlg94n1/Fu251q7BCQnnp1n7lsnLIMSu58DVOZ1FclpY0QVJbaeJ54 gZZm+pljO3dEMKHhJ1KPDTHOokR0bpnCqg4hYAuShxWZGGQ6mbnQmRHNBmecpfA7pc6r qAJRpg/qf4xa0KqoSu/zf02kfFwApd7tXj3h6U+Ba6iX7kP0Oy5jfLRHqYQS607hMC4H JA2lp//Xt/BCE0SecvehnlC6rq3z18umQFQhxfzPK6VVLEXkH1m7lMYclKGxz3eZAtzd ptuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb8-v6si5221957plb.178.2018.09.28.11.22.11; Fri, 28 Sep 2018 11:22:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbeI2ApV (ORCPT + 99 others); Fri, 28 Sep 2018 20:45:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbeI2ApU (ORCPT ); Fri, 28 Sep 2018 20:45:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41B16E3E18; Fri, 28 Sep 2018 18:20:21 +0000 (UTC) Received: from [10.40.204.119] (ovpn-204-119.brq.redhat.com [10.40.204.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 444A11852A; Fri, 28 Sep 2018 18:20:14 +0000 (UTC) Subject: Re: [RFC 01/20] ns: Introduce Time Namespace To: Dmitry Safonov , linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Adrian Reber , Andy Lutomirski , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Newsgroups: gmane.linux.kernel,gmane.linux.kernel.api References: <20180919205037.9574-1-dima@arista.com> <20180919205037.9574-2-dima@arista.com> From: Laurent Vivier Message-ID: <2087cf9b-89a1-e591-4dcd-4d98767a1be6@redhat.com> Date: Fri, 28 Sep 2018 20:20:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180919205037.9574-2-dima@arista.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 28 Sep 2018 18:20:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/09/2018 22:50, Dmitry Safonov wrote: > From: Andrei Vagin > > 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 > Co-developed-by: Dmitry Safonov > Signed-off-by: Dmitry Safonov > --- > 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