diff options
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | kernel/sched.c | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 8da84b7bc1b8..483c1ed5bc4d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1063,6 +1063,7 @@ struct sched_domain; | |||
1063 | */ | 1063 | */ |
1064 | #define WF_SYNC 0x01 /* waker goes to sleep after wakup */ | 1064 | #define WF_SYNC 0x01 /* waker goes to sleep after wakup */ |
1065 | #define WF_FORK 0x02 /* child wakeup after fork */ | 1065 | #define WF_FORK 0x02 /* child wakeup after fork */ |
1066 | #define WF_MIGRATED 0x04 /* internal use, task got migrated */ | ||
1066 | 1067 | ||
1067 | #define ENQUEUE_WAKEUP 1 | 1068 | #define ENQUEUE_WAKEUP 1 |
1068 | #define ENQUEUE_HEAD 2 | 1069 | #define ENQUEUE_HEAD 2 |
diff --git a/kernel/sched.c b/kernel/sched.c index 49cc70b152cf..2fe98ed474da 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2447,6 +2447,10 @@ ttwu_stat(struct task_struct *p, int cpu, int wake_flags) | |||
2447 | } | 2447 | } |
2448 | rcu_read_unlock(); | 2448 | rcu_read_unlock(); |
2449 | } | 2449 | } |
2450 | |||
2451 | if (wake_flags & WF_MIGRATED) | ||
2452 | schedstat_inc(p, se.statistics.nr_wakeups_migrate); | ||
2453 | |||
2450 | #endif /* CONFIG_SMP */ | 2454 | #endif /* CONFIG_SMP */ |
2451 | 2455 | ||
2452 | schedstat_inc(rq, ttwu_count); | 2456 | schedstat_inc(rq, ttwu_count); |
@@ -2455,9 +2459,6 @@ ttwu_stat(struct task_struct *p, int cpu, int wake_flags) | |||
2455 | if (wake_flags & WF_SYNC) | 2459 | if (wake_flags & WF_SYNC) |
2456 | schedstat_inc(p, se.statistics.nr_wakeups_sync); | 2460 | schedstat_inc(p, se.statistics.nr_wakeups_sync); |
2457 | 2461 | ||
2458 | if (cpu != task_cpu(p)) | ||
2459 | schedstat_inc(p, se.statistics.nr_wakeups_migrate); | ||
2460 | |||
2461 | #endif /* CONFIG_SCHEDSTATS */ | 2462 | #endif /* CONFIG_SCHEDSTATS */ |
2462 | } | 2463 | } |
2463 | 2464 | ||
@@ -2675,8 +2676,10 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) | |||
2675 | p->sched_class->task_waking(p); | 2676 | p->sched_class->task_waking(p); |
2676 | 2677 | ||
2677 | cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags); | 2678 | cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags); |
2678 | if (task_cpu(p) != cpu) | 2679 | if (task_cpu(p) != cpu) { |
2680 | wake_flags |= WF_MIGRATED; | ||
2679 | set_task_cpu(p, cpu); | 2681 | set_task_cpu(p, cpu); |
2682 | } | ||
2680 | #endif /* CONFIG_SMP */ | 2683 | #endif /* CONFIG_SMP */ |
2681 | 2684 | ||
2682 | ttwu_queue(p, cpu); | 2685 | ttwu_queue(p, cpu); |