diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-14 06:34:15 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-14 14:31:26 -0500 |
commit | 6c594c21fcb02c662f11c97be4d7d2b73060a205 (patch) | |
tree | dbd56d57fbc4576e18002a5cc08b1f4327a2248f /kernel/sched.c | |
parent | 5d6a27d8a096868ae313f71f563b06074a7e34fe (diff) |
perfcounters: add task migrations counter
Impact: add new feature, new sw counter
Add a counter that counts the number of cross-CPU migrations a
task is suffering.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 5c3f4106314e..382cfdb5e38d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -1852,12 +1852,14 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu) | |||
1852 | p->se.sleep_start -= clock_offset; | 1852 | p->se.sleep_start -= clock_offset; |
1853 | if (p->se.block_start) | 1853 | if (p->se.block_start) |
1854 | p->se.block_start -= clock_offset; | 1854 | p->se.block_start -= clock_offset; |
1855 | #endif | ||
1855 | if (old_cpu != new_cpu) { | 1856 | if (old_cpu != new_cpu) { |
1856 | schedstat_inc(p, se.nr_migrations); | 1857 | p->se.nr_migrations++; |
1858 | #ifdef CONFIG_SCHEDSTATS | ||
1857 | if (task_hot(p, old_rq->clock, NULL)) | 1859 | if (task_hot(p, old_rq->clock, NULL)) |
1858 | schedstat_inc(p, se.nr_forced2_migrations); | 1860 | schedstat_inc(p, se.nr_forced2_migrations); |
1859 | } | ||
1860 | #endif | 1861 | #endif |
1862 | } | ||
1861 | p->se.vruntime -= old_cfsrq->min_vruntime - | 1863 | p->se.vruntime -= old_cfsrq->min_vruntime - |
1862 | new_cfsrq->min_vruntime; | 1864 | new_cfsrq->min_vruntime; |
1863 | 1865 | ||
@@ -2375,6 +2377,7 @@ static void __sched_fork(struct task_struct *p) | |||
2375 | p->se.exec_start = 0; | 2377 | p->se.exec_start = 0; |
2376 | p->se.sum_exec_runtime = 0; | 2378 | p->se.sum_exec_runtime = 0; |
2377 | p->se.prev_sum_exec_runtime = 0; | 2379 | p->se.prev_sum_exec_runtime = 0; |
2380 | p->se.nr_migrations = 0; | ||
2378 | p->se.last_wakeup = 0; | 2381 | p->se.last_wakeup = 0; |
2379 | p->se.avg_overlap = 0; | 2382 | p->se.avg_overlap = 0; |
2380 | 2383 | ||