diff options
author | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2010-03-10 21:37:45 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-11 09:22:28 -0500 |
commit | 41acab8851a0408c1d5ad6c21a07456f88b54d40 (patch) | |
tree | 28b23b930571c1f6dfd5c4e8129a2a7ea2056307 /kernel/sched.c | |
parent | 3d07467b7aa91623b31d7b5888a123a2c8c8e9cc (diff) |
sched: Implement group scheduler statistics in one struct
Put all statistic fields of sched_entity in one struct, sched_statistics,
and embed it into sched_entity.
This change allows to memset the sched_statistics to 0 when needed (for
instance when forking), avoiding bugs of non initialized fields.
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1268275065-18542-1-git-send-email-lucas.de.marchi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 2c1db81f80eb..a4aa071f08f3 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2437,15 +2437,15 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, | |||
2437 | 2437 | ||
2438 | out_activate: | 2438 | out_activate: |
2439 | #endif /* CONFIG_SMP */ | 2439 | #endif /* CONFIG_SMP */ |
2440 | schedstat_inc(p, se.nr_wakeups); | 2440 | schedstat_inc(p, se.statistics.nr_wakeups); |
2441 | if (wake_flags & WF_SYNC) | 2441 | if (wake_flags & WF_SYNC) |
2442 | schedstat_inc(p, se.nr_wakeups_sync); | 2442 | schedstat_inc(p, se.statistics.nr_wakeups_sync); |
2443 | if (orig_cpu != cpu) | 2443 | if (orig_cpu != cpu) |
2444 | schedstat_inc(p, se.nr_wakeups_migrate); | 2444 | schedstat_inc(p, se.statistics.nr_wakeups_migrate); |
2445 | if (cpu == this_cpu) | 2445 | if (cpu == this_cpu) |
2446 | schedstat_inc(p, se.nr_wakeups_local); | 2446 | schedstat_inc(p, se.statistics.nr_wakeups_local); |
2447 | else | 2447 | else |
2448 | schedstat_inc(p, se.nr_wakeups_remote); | 2448 | schedstat_inc(p, se.statistics.nr_wakeups_remote); |
2449 | activate_task(rq, p, 1); | 2449 | activate_task(rq, p, 1); |
2450 | success = 1; | 2450 | success = 1; |
2451 | 2451 | ||
@@ -2532,36 +2532,7 @@ static void __sched_fork(struct task_struct *p) | |||
2532 | p->se.avg_wakeup = sysctl_sched_wakeup_granularity; | 2532 | p->se.avg_wakeup = sysctl_sched_wakeup_granularity; |
2533 | 2533 | ||
2534 | #ifdef CONFIG_SCHEDSTATS | 2534 | #ifdef CONFIG_SCHEDSTATS |
2535 | p->se.wait_start = 0; | 2535 | memset(&p->se.statistics, 0, sizeof(p->se.statistics)); |
2536 | p->se.wait_max = 0; | ||
2537 | p->se.wait_count = 0; | ||
2538 | p->se.wait_sum = 0; | ||
2539 | |||
2540 | p->se.sleep_start = 0; | ||
2541 | p->se.sleep_max = 0; | ||
2542 | p->se.sum_sleep_runtime = 0; | ||
2543 | |||
2544 | p->se.block_start = 0; | ||
2545 | p->se.block_max = 0; | ||
2546 | p->se.exec_max = 0; | ||
2547 | p->se.slice_max = 0; | ||
2548 | |||
2549 | p->se.nr_migrations_cold = 0; | ||
2550 | p->se.nr_failed_migrations_affine = 0; | ||
2551 | p->se.nr_failed_migrations_running = 0; | ||
2552 | p->se.nr_failed_migrations_hot = 0; | ||
2553 | p->se.nr_forced_migrations = 0; | ||
2554 | |||
2555 | p->se.nr_wakeups = 0; | ||
2556 | p->se.nr_wakeups_sync = 0; | ||
2557 | p->se.nr_wakeups_migrate = 0; | ||
2558 | p->se.nr_wakeups_local = 0; | ||
2559 | p->se.nr_wakeups_remote = 0; | ||
2560 | p->se.nr_wakeups_affine = 0; | ||
2561 | p->se.nr_wakeups_affine_attempts = 0; | ||
2562 | p->se.nr_wakeups_passive = 0; | ||
2563 | p->se.nr_wakeups_idle = 0; | ||
2564 | |||
2565 | #endif | 2536 | #endif |
2566 | 2537 | ||
2567 | INIT_LIST_HEAD(&p->rt.run_list); | 2538 | INIT_LIST_HEAD(&p->rt.run_list); |
@@ -7910,9 +7881,9 @@ void normalize_rt_tasks(void) | |||
7910 | 7881 | ||
7911 | p->se.exec_start = 0; | 7882 | p->se.exec_start = 0; |
7912 | #ifdef CONFIG_SCHEDSTATS | 7883 | #ifdef CONFIG_SCHEDSTATS |
7913 | p->se.wait_start = 0; | 7884 | p->se.statistics.wait_start = 0; |
7914 | p->se.sleep_start = 0; | 7885 | p->se.statistics.sleep_start = 0; |
7915 | p->se.block_start = 0; | 7886 | p->se.statistics.block_start = 0; |
7916 | #endif | 7887 | #endif |
7917 | 7888 | ||
7918 | if (!rt_task(p)) { | 7889 | if (!rt_task(p)) { |