aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2015-05-06 12:04:24 -0400
committerIngo Molnar <mingo@kernel.org>2015-05-07 06:02:51 -0400
commitfafe870f31212a72f3c2d74e7b90e4ef39e83ee1 (patch)
treec1b1ef375b480b26a827c3c6eb12eb2de7ed164a /include/linux
parentaed5ed47724f6a7453fa62e3c90f3cee93edbfe3 (diff)
context_tracking: Inherit TIF_NOHZ through forks instead of context switches
TIF_NOHZ is used by context_tracking to force syscall slow-path on every task in order to track userspace roundtrips. As such, it must be set on all running tasks. It's currently explicitly inherited through context switches. There is no need to do it in this fast-path though. The flag could simply be set once for all on all tasks, whether they are running or not. Lets do this by setting the flag for the init task on early boot, and let it propagate through fork inheritance. While at it, mark context_tracking_cpu_set() as init code, we only need it at early boot time. Suggested-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Dave Jones <davej@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Mike Galbraith <umgwanakikbuti@gmail.com> Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rafael J . Wysocki <rafael.j.wysocki@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1430928266-24888-3-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/context_tracking.h10
-rw-r--r--include/linux/sched.h3
2 files changed, 3 insertions, 10 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 2821838256b4..b96bd299966f 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -14,8 +14,6 @@ extern void context_tracking_enter(enum ctx_state state);
14extern void context_tracking_exit(enum ctx_state state); 14extern void context_tracking_exit(enum ctx_state state);
15extern void context_tracking_user_enter(void); 15extern void context_tracking_user_enter(void);
16extern void context_tracking_user_exit(void); 16extern void context_tracking_user_exit(void);
17extern void __context_tracking_task_switch(struct task_struct *prev,
18 struct task_struct *next);
19 17
20static inline void user_enter(void) 18static inline void user_enter(void)
21{ 19{
@@ -51,19 +49,11 @@ static inline void exception_exit(enum ctx_state prev_ctx)
51 } 49 }
52} 50}
53 51
54static inline void context_tracking_task_switch(struct task_struct *prev,
55 struct task_struct *next)
56{
57 if (context_tracking_is_enabled())
58 __context_tracking_task_switch(prev, next);
59}
60#else 52#else
61static inline void user_enter(void) { } 53static inline void user_enter(void) { }
62static inline void user_exit(void) { } 54static inline void user_exit(void) { }
63static inline enum ctx_state exception_enter(void) { return 0; } 55static inline enum ctx_state exception_enter(void) { return 0; }
64static inline void exception_exit(enum ctx_state prev_ctx) { } 56static inline void exception_exit(enum ctx_state prev_ctx) { }
65static inline void context_tracking_task_switch(struct task_struct *prev,
66 struct task_struct *next) { }
67#endif /* !CONFIG_CONTEXT_TRACKING */ 57#endif /* !CONFIG_CONTEXT_TRACKING */
68 58
69 59
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 26a2e6122734..185a750e4ed4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2532,6 +2532,9 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
2532} 2532}
2533#endif 2533#endif
2534 2534
2535#define tasklist_empty() \
2536 list_empty(&init_task.tasks)
2537
2535#define next_task(p) \ 2538#define next_task(p) \
2536 list_entry_rcu((p)->tasks.next, struct task_struct, tasks) 2539 list_entry_rcu((p)->tasks.next, struct task_struct, tasks)
2537 2540