aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/context_tracking.h11
-rw-r--r--kernel/context_tracking.c6
2 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 8854eadb2142..e070ea5dadac 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -40,6 +40,8 @@ extern void context_tracking_cpu_set(int cpu);
40 40
41extern void context_tracking_user_enter(void); 41extern void context_tracking_user_enter(void);
42extern void context_tracking_user_exit(void); 42extern void context_tracking_user_exit(void);
43extern void __context_tracking_task_switch(struct task_struct *prev,
44 struct task_struct *next);
43 45
44static inline void user_enter(void) 46static inline void user_enter(void)
45{ 47{
@@ -74,8 +76,12 @@ static inline void exception_exit(enum ctx_state prev_ctx)
74 } 76 }
75} 77}
76 78
77extern void context_tracking_task_switch(struct task_struct *prev, 79static inline void context_tracking_task_switch(struct task_struct *prev,
78 struct task_struct *next); 80 struct task_struct *next)
81{
82 if (static_key_false(&context_tracking_enabled))
83 __context_tracking_task_switch(prev, next);
84}
79#else 85#else
80static inline bool context_tracking_in_user(void) { return false; } 86static inline bool context_tracking_in_user(void) { return false; }
81static inline void user_enter(void) { } 87static inline void user_enter(void) { }
@@ -112,6 +118,7 @@ static inline void guest_exit(void)
112 else 118 else
113 current->flags &= ~PF_VCPU; 119 current->flags &= ~PF_VCPU;
114} 120}
121
115#else 122#else
116static inline void guest_enter(void) 123static inline void guest_enter(void)
117{ 124{
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index b6a186c4b886..c17822673c39 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -166,7 +166,7 @@ void context_tracking_user_exit(void)
166} 166}
167 167
168/** 168/**
169 * context_tracking_task_switch - context switch the syscall callbacks 169 * __context_tracking_task_switch - context switch the syscall callbacks
170 * @prev: the task that is being switched out 170 * @prev: the task that is being switched out
171 * @next: the task that is being switched in 171 * @next: the task that is being switched in
172 * 172 *
@@ -178,8 +178,8 @@ void context_tracking_user_exit(void)
178 * migrate to some CPU that doesn't do the context tracking. As such the TIF 178 * migrate to some CPU that doesn't do the context tracking. As such the TIF
179 * flag may not be desired there. 179 * flag may not be desired there.
180 */ 180 */
181void context_tracking_task_switch(struct task_struct *prev, 181void __context_tracking_task_switch(struct task_struct *prev,
182 struct task_struct *next) 182 struct task_struct *next)
183{ 183{
184 clear_tsk_thread_flag(prev, TIF_NOHZ); 184 clear_tsk_thread_flag(prev, TIF_NOHZ);
185 set_tsk_thread_flag(next, TIF_NOHZ); 185 set_tsk_thread_flag(next, TIF_NOHZ);