diff options
author | Mel Gorman <mgorman@suse.de> | 2014-01-21 18:51:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 19:19:48 -0500 |
commit | 286549dcaf4f128cb04f0ad56dfb677d7d19b500 (patch) | |
tree | b59153c8b9a43c4891c16704e78b53e9baaf7de6 /include/trace/events/sched.h | |
parent | 64a9a34e22896dad430e21a28ad8cb00a756fefc (diff) |
sched: add tracepoints related to NUMA task migration
This patch adds three tracepoints
o trace_sched_move_numa when a task is moved to a node
o trace_sched_swap_numa when a task is swapped with another task
o trace_sched_stick_numa when a numa-related migration fails
The tracepoints allow the NUMA scheduler activity to be monitored and the
following high-level metrics can be calculated
o NUMA migrated stuck nr trace_sched_stick_numa
o NUMA migrated idle nr trace_sched_move_numa
o NUMA migrated swapped nr trace_sched_swap_numa
o NUMA local swapped trace_sched_swap_numa src_nid == dst_nid (should never happen)
o NUMA remote swapped trace_sched_swap_numa src_nid != dst_nid (should == NUMA migrated swapped)
o NUMA group swapped trace_sched_swap_numa src_ngid == dst_ngid
Maybe a small number of these are acceptable
but a high number would be a major surprise.
It would be even worse if bounces are frequent.
o NUMA avg task migs. Average number of migrations for tasks
o NUMA stddev task mig Self-explanatory
o NUMA max task migs. Maximum number of migrations for a single task
In general the intent of the tracepoints is to help diagnose problems
where automatic NUMA balancing appears to be doing an excessive amount
of useless work.
[akpm@linux-foundation.org: remove semicolon-after-if, repair coding-style]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Alex Thorlton <athorlton@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/trace/events/sched.h')
-rw-r--r-- | include/trace/events/sched.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 04c308413a5d..67e1bbf83695 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
@@ -443,6 +443,93 @@ TRACE_EVENT(sched_process_hang, | |||
443 | ); | 443 | ); |
444 | #endif /* CONFIG_DETECT_HUNG_TASK */ | 444 | #endif /* CONFIG_DETECT_HUNG_TASK */ |
445 | 445 | ||
446 | DECLARE_EVENT_CLASS(sched_move_task_template, | ||
447 | |||
448 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), | ||
449 | |||
450 | TP_ARGS(tsk, src_cpu, dst_cpu), | ||
451 | |||
452 | TP_STRUCT__entry( | ||
453 | __field( pid_t, pid ) | ||
454 | __field( pid_t, tgid ) | ||
455 | __field( pid_t, ngid ) | ||
456 | __field( int, src_cpu ) | ||
457 | __field( int, src_nid ) | ||
458 | __field( int, dst_cpu ) | ||
459 | __field( int, dst_nid ) | ||
460 | ), | ||
461 | |||
462 | TP_fast_assign( | ||
463 | __entry->pid = task_pid_nr(tsk); | ||
464 | __entry->tgid = task_tgid_nr(tsk); | ||
465 | __entry->ngid = task_numa_group_id(tsk); | ||
466 | __entry->src_cpu = src_cpu; | ||
467 | __entry->src_nid = cpu_to_node(src_cpu); | ||
468 | __entry->dst_cpu = dst_cpu; | ||
469 | __entry->dst_nid = cpu_to_node(dst_cpu); | ||
470 | ), | ||
471 | |||
472 | TP_printk("pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d", | ||
473 | __entry->pid, __entry->tgid, __entry->ngid, | ||
474 | __entry->src_cpu, __entry->src_nid, | ||
475 | __entry->dst_cpu, __entry->dst_nid) | ||
476 | ); | ||
477 | |||
478 | /* | ||
479 | * Tracks migration of tasks from one runqueue to another. Can be used to | ||
480 | * detect if automatic NUMA balancing is bouncing between nodes | ||
481 | */ | ||
482 | DEFINE_EVENT(sched_move_task_template, sched_move_numa, | ||
483 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), | ||
484 | |||
485 | TP_ARGS(tsk, src_cpu, dst_cpu) | ||
486 | ); | ||
487 | |||
488 | DEFINE_EVENT(sched_move_task_template, sched_stick_numa, | ||
489 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), | ||
490 | |||
491 | TP_ARGS(tsk, src_cpu, dst_cpu) | ||
492 | ); | ||
493 | |||
494 | TRACE_EVENT(sched_swap_numa, | ||
495 | |||
496 | TP_PROTO(struct task_struct *src_tsk, int src_cpu, | ||
497 | struct task_struct *dst_tsk, int dst_cpu), | ||
498 | |||
499 | TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu), | ||
500 | |||
501 | TP_STRUCT__entry( | ||
502 | __field( pid_t, src_pid ) | ||
503 | __field( pid_t, src_tgid ) | ||
504 | __field( pid_t, src_ngid ) | ||
505 | __field( int, src_cpu ) | ||
506 | __field( int, src_nid ) | ||
507 | __field( pid_t, dst_pid ) | ||
508 | __field( pid_t, dst_tgid ) | ||
509 | __field( pid_t, dst_ngid ) | ||
510 | __field( int, dst_cpu ) | ||
511 | __field( int, dst_nid ) | ||
512 | ), | ||
513 | |||
514 | TP_fast_assign( | ||
515 | __entry->src_pid = task_pid_nr(src_tsk); | ||
516 | __entry->src_tgid = task_tgid_nr(src_tsk); | ||
517 | __entry->src_ngid = task_numa_group_id(src_tsk); | ||
518 | __entry->src_cpu = src_cpu; | ||
519 | __entry->src_nid = cpu_to_node(src_cpu); | ||
520 | __entry->dst_pid = task_pid_nr(dst_tsk); | ||
521 | __entry->dst_tgid = task_tgid_nr(dst_tsk); | ||
522 | __entry->dst_ngid = task_numa_group_id(dst_tsk); | ||
523 | __entry->dst_cpu = dst_cpu; | ||
524 | __entry->dst_nid = cpu_to_node(dst_cpu); | ||
525 | ), | ||
526 | |||
527 | 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", | ||
528 | __entry->src_pid, __entry->src_tgid, __entry->src_ngid, | ||
529 | __entry->src_cpu, __entry->src_nid, | ||
530 | __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, | ||
531 | __entry->dst_cpu, __entry->dst_nid) | ||
532 | ); | ||
446 | #endif /* _TRACE_SCHED_H */ | 533 | #endif /* _TRACE_SCHED_H */ |
447 | 534 | ||
448 | /* This part must be outside protection */ | 535 | /* This part must be outside protection */ |