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 /kernel/sched | |
| 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 'kernel/sched')
| -rw-r--r-- | kernel/sched/core.c | 2 | ||||
| -rw-r--r-- | kernel/sched/fair.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 36c951b7eef8..5ae36cc11fe5 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -1108,6 +1108,7 @@ int migrate_swap(struct task_struct *cur, struct task_struct *p) | |||
| 1108 | if (!cpumask_test_cpu(arg.src_cpu, tsk_cpus_allowed(arg.dst_task))) | 1108 | if (!cpumask_test_cpu(arg.src_cpu, tsk_cpus_allowed(arg.dst_task))) |
| 1109 | goto out; | 1109 | goto out; |
| 1110 | 1110 | ||
| 1111 | trace_sched_swap_numa(cur, arg.src_cpu, p, arg.dst_cpu); | ||
| 1111 | ret = stop_two_cpus(arg.dst_cpu, arg.src_cpu, migrate_swap_stop, &arg); | 1112 | ret = stop_two_cpus(arg.dst_cpu, arg.src_cpu, migrate_swap_stop, &arg); |
| 1112 | 1113 | ||
| 1113 | out: | 1114 | out: |
| @@ -4603,6 +4604,7 @@ int migrate_task_to(struct task_struct *p, int target_cpu) | |||
| 4603 | 4604 | ||
| 4604 | /* TODO: This is not properly updating schedstats */ | 4605 | /* TODO: This is not properly updating schedstats */ |
| 4605 | 4606 | ||
| 4607 | trace_sched_move_numa(p, curr_cpu, target_cpu); | ||
| 4606 | return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg); | 4608 | return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg); |
| 4607 | } | 4609 | } |
| 4608 | 4610 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b24b6cfde9aa..867b0a4b0893 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -1250,11 +1250,15 @@ static int task_numa_migrate(struct task_struct *p) | |||
| 1250 | p->numa_scan_period = task_scan_min(p); | 1250 | p->numa_scan_period = task_scan_min(p); |
| 1251 | 1251 | ||
| 1252 | if (env.best_task == NULL) { | 1252 | if (env.best_task == NULL) { |
| 1253 | int ret = migrate_task_to(p, env.best_cpu); | 1253 | ret = migrate_task_to(p, env.best_cpu); |
| 1254 | if (ret != 0) | ||
| 1255 | trace_sched_stick_numa(p, env.src_cpu, env.best_cpu); | ||
| 1254 | return ret; | 1256 | return ret; |
| 1255 | } | 1257 | } |
| 1256 | 1258 | ||
| 1257 | ret = migrate_swap(p, env.best_task); | 1259 | ret = migrate_swap(p, env.best_task); |
| 1260 | if (ret != 0) | ||
| 1261 | trace_sched_stick_numa(p, env.src_cpu, task_cpu(env.best_task)); | ||
| 1258 | put_task_struct(env.best_task); | 1262 | put_task_struct(env.best_task); |
| 1259 | return ret; | 1263 | return ret; |
| 1260 | } | 1264 | } |
