]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
d0b6e04a LZ |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM sched | |
4 | ||
ea20d929 | 5 | #if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ) |
0a16b607 MD |
6 | #define _TRACE_SCHED_H |
7 | ||
6a3827d7 | 8 | #include <linux/sched/numa_balancing.h> |
0a16b607 | 9 | #include <linux/tracepoint.h> |
4ff16c25 | 10 | #include <linux/binfmts.h> |
0a16b607 | 11 | |
ea20d929 SR |
12 | /* |
13 | * Tracepoint for calling kthread_stop, performed to end a kthread: | |
14 | */ | |
15 | TRACE_EVENT(sched_kthread_stop, | |
16 | ||
17 | TP_PROTO(struct task_struct *t), | |
18 | ||
19 | TP_ARGS(t), | |
20 | ||
21 | TP_STRUCT__entry( | |
22 | __array( char, comm, TASK_COMM_LEN ) | |
23 | __field( pid_t, pid ) | |
24 | ), | |
25 | ||
26 | TP_fast_assign( | |
27 | memcpy(__entry->comm, t->comm, TASK_COMM_LEN); | |
28 | __entry->pid = t->pid; | |
29 | ), | |
30 | ||
434a83c3 | 31 | TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) |
ea20d929 SR |
32 | ); |
33 | ||
34 | /* | |
35 | * Tracepoint for the return value of the kthread stopping: | |
36 | */ | |
37 | TRACE_EVENT(sched_kthread_stop_ret, | |
38 | ||
39 | TP_PROTO(int ret), | |
40 | ||
41 | TP_ARGS(ret), | |
42 | ||
43 | TP_STRUCT__entry( | |
44 | __field( int, ret ) | |
45 | ), | |
46 | ||
47 | TP_fast_assign( | |
48 | __entry->ret = ret; | |
49 | ), | |
50 | ||
434a83c3 | 51 | TP_printk("ret=%d", __entry->ret) |
ea20d929 SR |
52 | ); |
53 | ||
ea20d929 SR |
54 | /* |
55 | * Tracepoint for waking up a task: | |
ea20d929 | 56 | */ |
091ad365 | 57 | DECLARE_EVENT_CLASS(sched_wakeup_template, |
ea20d929 | 58 | |
fbd705a0 | 59 | TP_PROTO(struct task_struct *p), |
ea20d929 | 60 | |
fbd705a0 | 61 | TP_ARGS(__perf_task(p)), |
ea20d929 SR |
62 | |
63 | TP_STRUCT__entry( | |
64 | __array( char, comm, TASK_COMM_LEN ) | |
65 | __field( pid_t, pid ) | |
66 | __field( int, prio ) | |
67 | __field( int, success ) | |
434a83c3 | 68 | __field( int, target_cpu ) |
ea20d929 SR |
69 | ), |
70 | ||
71 | TP_fast_assign( | |
72 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | |
73 | __entry->pid = p->pid; | |
b91473ff | 74 | __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ |
fbd705a0 | 75 | __entry->success = 1; /* rudiment, kill when possible */ |
434a83c3 | 76 | __entry->target_cpu = task_cpu(p); |
ea20d929 SR |
77 | ), |
78 | ||
fbd705a0 | 79 | TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d", |
ea20d929 | 80 | __entry->comm, __entry->pid, __entry->prio, |
fbd705a0 | 81 | __entry->target_cpu) |
ea20d929 SR |
82 | ); |
83 | ||
fbd705a0 PZ |
84 | /* |
85 | * Tracepoint called when waking a task; this tracepoint is guaranteed to be | |
86 | * called from the waking context. | |
87 | */ | |
88 | DEFINE_EVENT(sched_wakeup_template, sched_waking, | |
89 | TP_PROTO(struct task_struct *p), | |
90 | TP_ARGS(p)); | |
91 | ||
92 | /* | |
93 | * Tracepoint called when the task is actually woken; p->state == TASK_RUNNNG. | |
94 | * It it not always called from the waking context. | |
95 | */ | |
75ec29ab | 96 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup, |
fbd705a0 PZ |
97 | TP_PROTO(struct task_struct *p), |
98 | TP_ARGS(p)); | |
75ec29ab | 99 | |
ea20d929 SR |
100 | /* |
101 | * Tracepoint for waking up a new task: | |
ea20d929 | 102 | */ |
75ec29ab | 103 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, |
fbd705a0 PZ |
104 | TP_PROTO(struct task_struct *p), |
105 | TP_ARGS(p)); | |
ea20d929 | 106 | |
02f72694 | 107 | #ifdef CREATE_TRACE_POINTS |
c73464b1 | 108 | static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p) |
02f72694 | 109 | { |
8f9fbf09 ON |
110 | #ifdef CONFIG_SCHED_DEBUG |
111 | BUG_ON(p != current); | |
112 | #endif /* CONFIG_SCHED_DEBUG */ | |
c73464b1 | 113 | |
02f72694 | 114 | /* |
c73464b1 PZ |
115 | * Preemption ignores task state, therefore preempted tasks are always |
116 | * RUNNING (we will not have dequeued if state != RUNNING). | |
02f72694 | 117 | */ |
efb40f58 | 118 | if (preempt) |
3f5fe9fe | 119 | return TASK_REPORT_MAX; |
efb40f58 | 120 | |
3f5fe9fe | 121 | return 1 << task_state_index(p); |
02f72694 | 122 | } |
8f9fbf09 | 123 | #endif /* CREATE_TRACE_POINTS */ |
02f72694 | 124 | |
ea20d929 SR |
125 | /* |
126 | * Tracepoint for task switches, performed by the scheduler: | |
ea20d929 SR |
127 | */ |
128 | TRACE_EVENT(sched_switch, | |
129 | ||
c73464b1 PZ |
130 | TP_PROTO(bool preempt, |
131 | struct task_struct *prev, | |
ea20d929 SR |
132 | struct task_struct *next), |
133 | ||
c73464b1 | 134 | TP_ARGS(preempt, prev, next), |
ea20d929 SR |
135 | |
136 | TP_STRUCT__entry( | |
137 | __array( char, prev_comm, TASK_COMM_LEN ) | |
138 | __field( pid_t, prev_pid ) | |
139 | __field( int, prev_prio ) | |
937cdb9d | 140 | __field( long, prev_state ) |
ea20d929 SR |
141 | __array( char, next_comm, TASK_COMM_LEN ) |
142 | __field( pid_t, next_pid ) | |
143 | __field( int, next_prio ) | |
144 | ), | |
145 | ||
146 | TP_fast_assign( | |
147 | memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); | |
148 | __entry->prev_pid = prev->pid; | |
149 | __entry->prev_prio = prev->prio; | |
c73464b1 | 150 | __entry->prev_state = __trace_sched_switch_state(preempt, prev); |
ea20d929 SR |
151 | memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); |
152 | __entry->next_pid = next->pid; | |
153 | __entry->next_prio = next->prio; | |
b91473ff | 154 | /* XXX SCHED_DEADLINE */ |
ea20d929 SR |
155 | ), |
156 | ||
557ab425 | 157 | TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d", |
ea20d929 | 158 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, |
efb40f58 | 159 | |
06eb6184 PZ |
160 | (__entry->prev_state & (TASK_REPORT_MAX - 1)) ? |
161 | __print_flags(__entry->prev_state & (TASK_REPORT_MAX - 1), "|", | |
ff28915f UKK |
162 | { TASK_INTERRUPTIBLE, "S" }, |
163 | { TASK_UNINTERRUPTIBLE, "D" }, | |
164 | { __TASK_STOPPED, "T" }, | |
165 | { __TASK_TRACED, "t" }, | |
166 | { EXIT_DEAD, "X" }, | |
167 | { EXIT_ZOMBIE, "Z" }, | |
168 | { TASK_PARKED, "P" }, | |
169 | { TASK_DEAD, "I" }) : | |
efb40f58 PZ |
170 | "R", |
171 | ||
3f5fe9fe | 172 | __entry->prev_state & TASK_REPORT_MAX ? "+" : "", |
ea20d929 SR |
173 | __entry->next_comm, __entry->next_pid, __entry->next_prio) |
174 | ); | |
175 | ||
176 | /* | |
177 | * Tracepoint for a task being migrated: | |
178 | */ | |
179 | TRACE_EVENT(sched_migrate_task, | |
180 | ||
de1d7286 | 181 | TP_PROTO(struct task_struct *p, int dest_cpu), |
ea20d929 | 182 | |
de1d7286 | 183 | TP_ARGS(p, dest_cpu), |
ea20d929 SR |
184 | |
185 | TP_STRUCT__entry( | |
186 | __array( char, comm, TASK_COMM_LEN ) | |
187 | __field( pid_t, pid ) | |
188 | __field( int, prio ) | |
189 | __field( int, orig_cpu ) | |
190 | __field( int, dest_cpu ) | |
191 | ), | |
192 | ||
193 | TP_fast_assign( | |
194 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | |
195 | __entry->pid = p->pid; | |
b91473ff | 196 | __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ |
de1d7286 | 197 | __entry->orig_cpu = task_cpu(p); |
ea20d929 SR |
198 | __entry->dest_cpu = dest_cpu; |
199 | ), | |
200 | ||
434a83c3 | 201 | TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d", |
ea20d929 SR |
202 | __entry->comm, __entry->pid, __entry->prio, |
203 | __entry->orig_cpu, __entry->dest_cpu) | |
204 | ); | |
205 | ||
091ad365 | 206 | DECLARE_EVENT_CLASS(sched_process_template, |
ea20d929 SR |
207 | |
208 | TP_PROTO(struct task_struct *p), | |
209 | ||
210 | TP_ARGS(p), | |
211 | ||
212 | TP_STRUCT__entry( | |
213 | __array( char, comm, TASK_COMM_LEN ) | |
214 | __field( pid_t, pid ) | |
215 | __field( int, prio ) | |
216 | ), | |
217 | ||
218 | TP_fast_assign( | |
219 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | |
220 | __entry->pid = p->pid; | |
b91473ff | 221 | __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ |
ea20d929 SR |
222 | ), |
223 | ||
434a83c3 | 224 | TP_printk("comm=%s pid=%d prio=%d", |
ea20d929 SR |
225 | __entry->comm, __entry->pid, __entry->prio) |
226 | ); | |
227 | ||
228 | /* | |
75ec29ab | 229 | * Tracepoint for freeing a task: |
ea20d929 | 230 | */ |
75ec29ab SR |
231 | DEFINE_EVENT(sched_process_template, sched_process_free, |
232 | TP_PROTO(struct task_struct *p), | |
233 | TP_ARGS(p)); | |
234 | ||
ea20d929 | 235 | |
75ec29ab SR |
236 | /* |
237 | * Tracepoint for a task exiting: | |
238 | */ | |
239 | DEFINE_EVENT(sched_process_template, sched_process_exit, | |
240 | TP_PROTO(struct task_struct *p), | |
241 | TP_ARGS(p)); | |
ea20d929 | 242 | |
210f7669 LZ |
243 | /* |
244 | * Tracepoint for waiting on task to unschedule: | |
245 | */ | |
246 | DEFINE_EVENT(sched_process_template, sched_wait_task, | |
247 | TP_PROTO(struct task_struct *p), | |
248 | TP_ARGS(p)); | |
249 | ||
ea20d929 SR |
250 | /* |
251 | * Tracepoint for a waiting task: | |
252 | */ | |
253 | TRACE_EVENT(sched_process_wait, | |
254 | ||
255 | TP_PROTO(struct pid *pid), | |
256 | ||
257 | TP_ARGS(pid), | |
258 | ||
259 | TP_STRUCT__entry( | |
260 | __array( char, comm, TASK_COMM_LEN ) | |
261 | __field( pid_t, pid ) | |
262 | __field( int, prio ) | |
263 | ), | |
264 | ||
265 | TP_fast_assign( | |
266 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | |
267 | __entry->pid = pid_nr(pid); | |
b91473ff | 268 | __entry->prio = current->prio; /* XXX SCHED_DEADLINE */ |
ea20d929 SR |
269 | ), |
270 | ||
434a83c3 | 271 | TP_printk("comm=%s pid=%d prio=%d", |
ea20d929 SR |
272 | __entry->comm, __entry->pid, __entry->prio) |
273 | ); | |
274 | ||
275 | /* | |
276 | * Tracepoint for do_fork: | |
277 | */ | |
278 | TRACE_EVENT(sched_process_fork, | |
279 | ||
280 | TP_PROTO(struct task_struct *parent, struct task_struct *child), | |
281 | ||
282 | TP_ARGS(parent, child), | |
283 | ||
284 | TP_STRUCT__entry( | |
285 | __array( char, parent_comm, TASK_COMM_LEN ) | |
286 | __field( pid_t, parent_pid ) | |
287 | __array( char, child_comm, TASK_COMM_LEN ) | |
288 | __field( pid_t, child_pid ) | |
289 | ), | |
290 | ||
291 | TP_fast_assign( | |
292 | memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); | |
293 | __entry->parent_pid = parent->pid; | |
294 | memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); | |
295 | __entry->child_pid = child->pid; | |
296 | ), | |
297 | ||
434a83c3 | 298 | TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d", |
ea20d929 SR |
299 | __entry->parent_comm, __entry->parent_pid, |
300 | __entry->child_comm, __entry->child_pid) | |
301 | ); | |
302 | ||
4ff16c25 DS |
303 | /* |
304 | * Tracepoint for exec: | |
305 | */ | |
306 | TRACE_EVENT(sched_process_exec, | |
307 | ||
308 | TP_PROTO(struct task_struct *p, pid_t old_pid, | |
309 | struct linux_binprm *bprm), | |
310 | ||
311 | TP_ARGS(p, old_pid, bprm), | |
312 | ||
313 | TP_STRUCT__entry( | |
314 | __string( filename, bprm->filename ) | |
315 | __field( pid_t, pid ) | |
316 | __field( pid_t, old_pid ) | |
317 | ), | |
318 | ||
319 | TP_fast_assign( | |
320 | __assign_str(filename, bprm->filename); | |
321 | __entry->pid = p->pid; | |
6308191f | 322 | __entry->old_pid = old_pid; |
4ff16c25 DS |
323 | ), |
324 | ||
325 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), | |
326 | __entry->pid, __entry->old_pid) | |
327 | ); | |
328 | ||
768d0c27 PZ |
329 | /* |
330 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE | |
331 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. | |
332 | */ | |
091ad365 | 333 | DECLARE_EVENT_CLASS(sched_stat_template, |
768d0c27 PZ |
334 | |
335 | TP_PROTO(struct task_struct *tsk, u64 delay), | |
336 | ||
12473965 | 337 | TP_ARGS(__perf_task(tsk), __perf_count(delay)), |
768d0c27 PZ |
338 | |
339 | TP_STRUCT__entry( | |
340 | __array( char, comm, TASK_COMM_LEN ) | |
341 | __field( pid_t, pid ) | |
342 | __field( u64, delay ) | |
343 | ), | |
344 | ||
345 | TP_fast_assign( | |
346 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); | |
347 | __entry->pid = tsk->pid; | |
348 | __entry->delay = delay; | |
768d0c27 PZ |
349 | ), |
350 | ||
434a83c3 | 351 | TP_printk("comm=%s pid=%d delay=%Lu [ns]", |
768d0c27 PZ |
352 | __entry->comm, __entry->pid, |
353 | (unsigned long long)__entry->delay) | |
354 | ); | |
355 | ||
75ec29ab SR |
356 | |
357 | /* | |
358 | * Tracepoint for accounting wait time (time the task is runnable | |
359 | * but not actually running due to scheduler contention). | |
360 | */ | |
361 | DEFINE_EVENT(sched_stat_template, sched_stat_wait, | |
362 | TP_PROTO(struct task_struct *tsk, u64 delay), | |
363 | TP_ARGS(tsk, delay)); | |
364 | ||
365 | /* | |
366 | * Tracepoint for accounting sleep time (time the task is not runnable, | |
367 | * including iowait, see below). | |
368 | */ | |
470dda74 LZ |
369 | DEFINE_EVENT(sched_stat_template, sched_stat_sleep, |
370 | TP_PROTO(struct task_struct *tsk, u64 delay), | |
371 | TP_ARGS(tsk, delay)); | |
75ec29ab SR |
372 | |
373 | /* | |
374 | * Tracepoint for accounting iowait time (time the task is not runnable | |
375 | * due to waiting on IO to complete). | |
376 | */ | |
470dda74 LZ |
377 | DEFINE_EVENT(sched_stat_template, sched_stat_iowait, |
378 | TP_PROTO(struct task_struct *tsk, u64 delay), | |
379 | TP_ARGS(tsk, delay)); | |
75ec29ab | 380 | |
b781a602 AV |
381 | /* |
382 | * Tracepoint for accounting blocked time (time the task is in uninterruptible). | |
383 | */ | |
384 | DEFINE_EVENT(sched_stat_template, sched_stat_blocked, | |
385 | TP_PROTO(struct task_struct *tsk, u64 delay), | |
386 | TP_ARGS(tsk, delay)); | |
387 | ||
f977bb49 IM |
388 | /* |
389 | * Tracepoint for accounting runtime (time the task is executing | |
390 | * on a CPU). | |
391 | */ | |
36009d07 | 392 | DECLARE_EVENT_CLASS(sched_stat_runtime, |
f977bb49 IM |
393 | |
394 | TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), | |
395 | ||
12473965 | 396 | TP_ARGS(tsk, __perf_count(runtime), vruntime), |
f977bb49 IM |
397 | |
398 | TP_STRUCT__entry( | |
399 | __array( char, comm, TASK_COMM_LEN ) | |
400 | __field( pid_t, pid ) | |
401 | __field( u64, runtime ) | |
402 | __field( u64, vruntime ) | |
403 | ), | |
404 | ||
405 | TP_fast_assign( | |
406 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); | |
407 | __entry->pid = tsk->pid; | |
408 | __entry->runtime = runtime; | |
409 | __entry->vruntime = vruntime; | |
f977bb49 IM |
410 | ), |
411 | ||
434a83c3 | 412 | TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", |
f977bb49 IM |
413 | __entry->comm, __entry->pid, |
414 | (unsigned long long)__entry->runtime, | |
415 | (unsigned long long)__entry->vruntime) | |
416 | ); | |
417 | ||
36009d07 ON |
418 | DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime, |
419 | TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), | |
420 | TP_ARGS(tsk, runtime, vruntime)); | |
421 | ||
a8027073 SR |
422 | /* |
423 | * Tracepoint for showing priority inheritance modifying a tasks | |
424 | * priority. | |
425 | */ | |
426 | TRACE_EVENT(sched_pi_setprio, | |
427 | ||
b91473ff | 428 | TP_PROTO(struct task_struct *tsk, struct task_struct *pi_task), |
a8027073 | 429 | |
b91473ff | 430 | TP_ARGS(tsk, pi_task), |
a8027073 SR |
431 | |
432 | TP_STRUCT__entry( | |
433 | __array( char, comm, TASK_COMM_LEN ) | |
434 | __field( pid_t, pid ) | |
435 | __field( int, oldprio ) | |
436 | __field( int, newprio ) | |
437 | ), | |
438 | ||
439 | TP_fast_assign( | |
440 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); | |
441 | __entry->pid = tsk->pid; | |
442 | __entry->oldprio = tsk->prio; | |
4ff648de SAS |
443 | __entry->newprio = pi_task ? |
444 | min(tsk->normal_prio, pi_task->prio) : | |
445 | tsk->normal_prio; | |
b91473ff | 446 | /* XXX SCHED_DEADLINE bits missing */ |
a8027073 SR |
447 | ), |
448 | ||
449 | TP_printk("comm=%s pid=%d oldprio=%d newprio=%d", | |
450 | __entry->comm, __entry->pid, | |
451 | __entry->oldprio, __entry->newprio) | |
452 | ); | |
453 | ||
6a716c90 ON |
454 | #ifdef CONFIG_DETECT_HUNG_TASK |
455 | TRACE_EVENT(sched_process_hang, | |
456 | TP_PROTO(struct task_struct *tsk), | |
457 | TP_ARGS(tsk), | |
458 | ||
459 | TP_STRUCT__entry( | |
460 | __array( char, comm, TASK_COMM_LEN ) | |
461 | __field( pid_t, pid ) | |
462 | ), | |
463 | ||
464 | TP_fast_assign( | |
465 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); | |
466 | __entry->pid = tsk->pid; | |
467 | ), | |
468 | ||
469 | TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) | |
470 | ); | |
471 | #endif /* CONFIG_DETECT_HUNG_TASK */ | |
472 | ||
286549dc MG |
473 | DECLARE_EVENT_CLASS(sched_move_task_template, |
474 | ||
475 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), | |
476 | ||
477 | TP_ARGS(tsk, src_cpu, dst_cpu), | |
478 | ||
479 | TP_STRUCT__entry( | |
480 | __field( pid_t, pid ) | |
481 | __field( pid_t, tgid ) | |
482 | __field( pid_t, ngid ) | |
483 | __field( int, src_cpu ) | |
484 | __field( int, src_nid ) | |
485 | __field( int, dst_cpu ) | |
486 | __field( int, dst_nid ) | |
487 | ), | |
488 | ||
489 | TP_fast_assign( | |
490 | __entry->pid = task_pid_nr(tsk); | |
491 | __entry->tgid = task_tgid_nr(tsk); | |
492 | __entry->ngid = task_numa_group_id(tsk); | |
493 | __entry->src_cpu = src_cpu; | |
494 | __entry->src_nid = cpu_to_node(src_cpu); | |
495 | __entry->dst_cpu = dst_cpu; | |
496 | __entry->dst_nid = cpu_to_node(dst_cpu); | |
497 | ), | |
498 | ||
499 | TP_printk("pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d", | |
500 | __entry->pid, __entry->tgid, __entry->ngid, | |
501 | __entry->src_cpu, __entry->src_nid, | |
502 | __entry->dst_cpu, __entry->dst_nid) | |
503 | ); | |
504 | ||
505 | /* | |
506 | * Tracks migration of tasks from one runqueue to another. Can be used to | |
507 | * detect if automatic NUMA balancing is bouncing between nodes | |
508 | */ | |
509 | DEFINE_EVENT(sched_move_task_template, sched_move_numa, | |
510 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), | |
511 | ||
512 | TP_ARGS(tsk, src_cpu, dst_cpu) | |
513 | ); | |
514 | ||
515 | DEFINE_EVENT(sched_move_task_template, sched_stick_numa, | |
516 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), | |
517 | ||
518 | TP_ARGS(tsk, src_cpu, dst_cpu) | |
519 | ); | |
520 | ||
521 | TRACE_EVENT(sched_swap_numa, | |
522 | ||
523 | TP_PROTO(struct task_struct *src_tsk, int src_cpu, | |
524 | struct task_struct *dst_tsk, int dst_cpu), | |
525 | ||
526 | TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu), | |
527 | ||
528 | TP_STRUCT__entry( | |
529 | __field( pid_t, src_pid ) | |
530 | __field( pid_t, src_tgid ) | |
531 | __field( pid_t, src_ngid ) | |
532 | __field( int, src_cpu ) | |
533 | __field( int, src_nid ) | |
534 | __field( pid_t, dst_pid ) | |
535 | __field( pid_t, dst_tgid ) | |
536 | __field( pid_t, dst_ngid ) | |
537 | __field( int, dst_cpu ) | |
538 | __field( int, dst_nid ) | |
539 | ), | |
540 | ||
541 | TP_fast_assign( | |
542 | __entry->src_pid = task_pid_nr(src_tsk); | |
543 | __entry->src_tgid = task_tgid_nr(src_tsk); | |
544 | __entry->src_ngid = task_numa_group_id(src_tsk); | |
545 | __entry->src_cpu = src_cpu; | |
546 | __entry->src_nid = cpu_to_node(src_cpu); | |
547 | __entry->dst_pid = task_pid_nr(dst_tsk); | |
548 | __entry->dst_tgid = task_tgid_nr(dst_tsk); | |
549 | __entry->dst_ngid = task_numa_group_id(dst_tsk); | |
550 | __entry->dst_cpu = dst_cpu; | |
551 | __entry->dst_nid = cpu_to_node(dst_cpu); | |
552 | ), | |
553 | ||
554 | TP_printk("src_pid=%d src_tgid=%d src_ngid=%d src_cpu=%d src_nid=%d dst_pid=%d dst_tgid=%d dst_ngid=%d dst_cpu=%d dst_nid=%d", | |
555 | __entry->src_pid, __entry->src_tgid, __entry->src_ngid, | |
556 | __entry->src_cpu, __entry->src_nid, | |
557 | __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, | |
558 | __entry->dst_cpu, __entry->dst_nid) | |
559 | ); | |
dfc68f29 AL |
560 | |
561 | /* | |
562 | * Tracepoint for waking a polling cpu without an IPI. | |
563 | */ | |
564 | TRACE_EVENT(sched_wake_idle_without_ipi, | |
565 | ||
566 | TP_PROTO(int cpu), | |
567 | ||
568 | TP_ARGS(cpu), | |
569 | ||
570 | TP_STRUCT__entry( | |
571 | __field( int, cpu ) | |
572 | ), | |
573 | ||
574 | TP_fast_assign( | |
575 | __entry->cpu = cpu; | |
576 | ), | |
577 | ||
578 | TP_printk("cpu=%d", __entry->cpu) | |
579 | ); | |
ea20d929 | 580 | #endif /* _TRACE_SCHED_H */ |
a8d154b0 SR |
581 | |
582 | /* This part must be outside protection */ | |
583 | #include <trace/define_trace.h> |