diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-05-12 15:20:53 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 15:08:47 -0400 |
| commit | 88a4216c3ec4281fc7e6725cc3a3ccd01fb1aa14 (patch) | |
| tree | 3d93bdfa757da02953ec2532f7504a2e7f81ea78 | |
| parent | 36fc25a9f48deacd8aa08cd2d1c186a4e412604f (diff) | |
ftrace: sched special
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| -rw-r--r-- | include/linux/sched.h | 6 | ||||
| -rw-r--r-- | kernel/sched_fair.c | 3 | ||||
| -rw-r--r-- | kernel/trace/trace.c | 6 | ||||
| -rw-r--r-- | kernel/trace/trace_sched_switch.c | 24 |
4 files changed, 36 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5b186bed54bc..360ca99033d2 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -2138,6 +2138,8 @@ extern void | |||
| 2138 | ftrace_wake_up_task(void *rq, struct task_struct *wakee, | 2138 | ftrace_wake_up_task(void *rq, struct task_struct *wakee, |
| 2139 | struct task_struct *curr); | 2139 | struct task_struct *curr); |
| 2140 | extern void ftrace_all_fair_tasks(void *__rq, void *__tr, void *__data); | 2140 | extern void ftrace_all_fair_tasks(void *__rq, void *__tr, void *__data); |
| 2141 | extern void | ||
| 2142 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
| 2141 | #else | 2143 | #else |
| 2142 | static inline void | 2144 | static inline void |
| 2143 | ftrace_ctx_switch(void *rq, struct task_struct *prev, struct task_struct *next) | 2145 | ftrace_ctx_switch(void *rq, struct task_struct *prev, struct task_struct *next) |
| @@ -2155,6 +2157,10 @@ ftrace_wake_up_task(void *rq, struct task_struct *wakee, | |||
| 2155 | static inline void ftrace_all_fair_tasks(void *__rq, void *__tr, void *__data) | 2157 | static inline void ftrace_all_fair_tasks(void *__rq, void *__tr, void *__data) |
| 2156 | { | 2158 | { |
| 2157 | } | 2159 | } |
| 2160 | static inline void | ||
| 2161 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) | ||
| 2162 | { | ||
| 2163 | } | ||
| 2158 | #endif | 2164 | #endif |
| 2159 | 2165 | ||
| 2160 | extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); | 2166 | extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index e24ecd39c4b8..dc1856f10795 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
| @@ -1061,6 +1061,8 @@ wake_affine(struct rq *rq, struct sched_domain *this_sd, struct rq *this_rq, | |||
| 1061 | if (!(this_sd->flags & SD_WAKE_AFFINE)) | 1061 | if (!(this_sd->flags & SD_WAKE_AFFINE)) |
| 1062 | return 0; | 1062 | return 0; |
| 1063 | 1063 | ||
| 1064 | ftrace_special(__LINE__, curr->se.avg_overlap, sync); | ||
| 1065 | ftrace_special(__LINE__, p->se.avg_overlap, -1); | ||
| 1064 | /* | 1066 | /* |
| 1065 | * If the currently running task will sleep within | 1067 | * If the currently running task will sleep within |
| 1066 | * a reasonable amount of time then attract this newly | 1068 | * a reasonable amount of time then attract this newly |
| @@ -1238,6 +1240,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p) | |||
| 1238 | if (unlikely(se == pse)) | 1240 | if (unlikely(se == pse)) |
| 1239 | return; | 1241 | return; |
| 1240 | 1242 | ||
| 1243 | ftrace_special(__LINE__, p->pid, se->last_wakeup); | ||
| 1241 | cfs_rq_of(pse)->next = pse; | 1244 | cfs_rq_of(pse)->next = pse; |
| 1242 | 1245 | ||
| 1243 | /* | 1246 | /* |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 3a4032492fcb..b87a26414892 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -1251,7 +1251,7 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) | |||
| 1251 | comm); | 1251 | comm); |
| 1252 | break; | 1252 | break; |
| 1253 | case TRACE_SPECIAL: | 1253 | case TRACE_SPECIAL: |
| 1254 | trace_seq_printf(s, " %ld %ld %ld\n", | 1254 | trace_seq_printf(s, "# %ld %ld %ld\n", |
| 1255 | entry->special.arg1, | 1255 | entry->special.arg1, |
| 1256 | entry->special.arg2, | 1256 | entry->special.arg2, |
| 1257 | entry->special.arg3); | 1257 | entry->special.arg3); |
| @@ -1335,7 +1335,7 @@ static int print_trace_fmt(struct trace_iterator *iter) | |||
| 1335 | return 0; | 1335 | return 0; |
| 1336 | break; | 1336 | break; |
| 1337 | case TRACE_SPECIAL: | 1337 | case TRACE_SPECIAL: |
| 1338 | ret = trace_seq_printf(s, " %ld %ld %ld\n", | 1338 | ret = trace_seq_printf(s, "# %ld %ld %ld\n", |
| 1339 | entry->special.arg1, | 1339 | entry->special.arg1, |
| 1340 | entry->special.arg2, | 1340 | entry->special.arg2, |
| 1341 | entry->special.arg3); | 1341 | entry->special.arg3); |
| @@ -1400,7 +1400,7 @@ static int print_raw_fmt(struct trace_iterator *iter) | |||
| 1400 | break; | 1400 | break; |
| 1401 | case TRACE_SPECIAL: | 1401 | case TRACE_SPECIAL: |
| 1402 | case TRACE_STACK: | 1402 | case TRACE_STACK: |
| 1403 | ret = trace_seq_printf(s, " %ld %ld %ld\n", | 1403 | ret = trace_seq_printf(s, "# %ld %ld %ld\n", |
| 1404 | entry->special.arg1, | 1404 | entry->special.arg1, |
| 1405 | entry->special.arg2, | 1405 | entry->special.arg2, |
| 1406 | entry->special.arg3); | 1406 | entry->special.arg3); |
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index 5a217e863586..bddf676914ed 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
| @@ -103,6 +103,30 @@ ftrace_wake_up_task(void *__rq, struct task_struct *wakee, | |||
| 103 | wakeup_sched_wakeup(wakee, curr); | 103 | wakeup_sched_wakeup(wakee, curr); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | void | ||
| 107 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) | ||
| 108 | { | ||
| 109 | struct trace_array *tr = ctx_trace; | ||
| 110 | struct trace_array_cpu *data; | ||
| 111 | unsigned long flags; | ||
| 112 | long disabled; | ||
| 113 | int cpu; | ||
| 114 | |||
| 115 | if (!tracer_enabled) | ||
| 116 | return; | ||
| 117 | |||
| 118 | local_irq_save(flags); | ||
| 119 | cpu = raw_smp_processor_id(); | ||
| 120 | data = tr->data[cpu]; | ||
| 121 | disabled = atomic_inc_return(&data->disabled); | ||
| 122 | |||
| 123 | if (likely(disabled == 1)) | ||
| 124 | __trace_special(tr, data, arg1, arg2, arg3); | ||
| 125 | |||
| 126 | atomic_dec(&data->disabled); | ||
| 127 | local_irq_restore(flags); | ||
| 128 | } | ||
| 129 | |||
| 106 | static void sched_switch_reset(struct trace_array *tr) | 130 | static void sched_switch_reset(struct trace_array *tr) |
| 107 | { | 131 | { |
| 108 | int cpu; | 132 | int cpu; |
