summaryrefslogtreecommitdiff
path: root/include/linux/time_namespace.h
diff options
context:
space:
mode:
authorDmitry Safonov <dima@arista.com>2019-11-12 04:27:12 +0300
committerThomas Gleixner <tglx@linutronix.de>2020-01-14 14:20:58 +0300
commitafaa7b5ac7c87479fb5a626f87d2157af30d6401 (patch)
treeb2a6d2d4843e2ffc10b018e9d61c4e9ba7274a9d /include/linux/time_namespace.h
parent550a77a74c87ecfdadc2214fef4b25ff125f65ab (diff)
downloadlinux-afaa7b5ac7c87479fb5a626f87d2157af30d6401.tar.xz
time: Allocate per-timens vvar page
VDSO support for Time namespace needs to set up a page with the same layout as VVAR. That timens page will be placed on position of VVAR page inside namespace. That page contains time namespace clock offsets and it has vdso_data->seq set to 1 to enforce the slow path and vdso_data->clock_mode set to VCLOCK_TIMENS to enforce the time namespace handling path. Allocate the timens page during namespace creation. Setup the offsets when the first task enters the ns and freeze them to guarantee the pace of monotonic/boottime clocks and to avoid breakage of applications. The design decision is to have a global offset_lock which is used during namespace offsets setup and to freeze offsets when the first task joins the new time namespace. That is better in terms of memory usage compared to having a per namespace mutex that's used only during the setup period. Suggested-by: Andy Lutomirski <luto@kernel.org> Based-on-work-by: Thomas Gleixner <tglx@linutronix.de> Co-developed-by: Andrei Vagin <avagin@gmail.com> Signed-off-by: Andrei Vagin <avagin@gmail.com> Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20191112012724.250792-24-dima@arista.com
Diffstat (limited to 'include/linux/time_namespace.h')
-rw-r--r--include/linux/time_namespace.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/time_namespace.h b/include/linux/time_namespace.h
index 063a343d1d78..6b7767f7df4a 100644
--- a/include/linux/time_namespace.h
+++ b/include/linux/time_namespace.h
@@ -23,6 +23,9 @@ struct time_namespace {
struct ucounts *ucounts;
struct ns_common ns;
struct timens_offsets offsets;
+ struct page *vvar_page;
+ /* If set prevents changing offsets after any task joined namespace. */
+ bool frozen_offsets;
} __randomize_layout;
extern struct time_namespace init_time_ns;