diff options
| author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-11-06 13:20:29 -0500 |
|---|---|---|
| committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-11-06 13:20:29 -0500 |
| commit | 5091ac6ebbfb121ba218d04fa0d59cbdf4ba2bb1 (patch) | |
| tree | bcd193af7f2c089a5958a0748b4c0799ea53a406 /kernel | |
| parent | d41b67e9ebe9b5fe52c1268e038da4cb6cfd40ac (diff) | |
LITMUS: export CPU stagger offset
Let scheduler plugins inquire stagger offsets.
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/time/tick-sched.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 3b1936fac0..d6dad226a1 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -583,6 +583,26 @@ static int __init tick_set_quanta_type(char *str) | |||
| 583 | } | 583 | } |
| 584 | __setup("quanta=", tick_set_quanta_type); | 584 | __setup("quanta=", tick_set_quanta_type); |
| 585 | 585 | ||
| 586 | u64 cpu_stagger_offset(int cpu) | ||
| 587 | { | ||
| 588 | u64 offset = 0; | ||
| 589 | switch (quanta_type) { | ||
| 590 | case LITMUS_ALIGNED_TICKS: | ||
| 591 | offset = 0; | ||
| 592 | break; | ||
| 593 | case LITMUS_STAGGERED_TICKS: | ||
| 594 | offset = ktime_to_ns(tick_period); | ||
| 595 | do_div(offset, num_possible_cpus()); | ||
| 596 | offset *= cpu; | ||
| 597 | break; | ||
| 598 | default: | ||
| 599 | offset = ktime_to_ns(tick_period) >> 1; | ||
| 600 | do_div(offset, num_possible_cpus()); | ||
| 601 | offset *= cpu; | ||
| 602 | } | ||
| 603 | return offset; | ||
| 604 | } | ||
| 605 | |||
| 586 | /** | 606 | /** |
| 587 | * tick_setup_sched_timer - setup the tick emulation timer | 607 | * tick_setup_sched_timer - setup the tick emulation timer |
| 588 | */ | 608 | */ |
| @@ -603,20 +623,7 @@ void tick_setup_sched_timer(void) | |||
| 603 | ts->sched_timer.expires = tick_init_jiffy_update(); | 623 | ts->sched_timer.expires = tick_init_jiffy_update(); |
| 604 | 624 | ||
| 605 | /* Offset must be set correctly to achieve desired quanta type. */ | 625 | /* Offset must be set correctly to achieve desired quanta type. */ |
| 606 | switch (quanta_type) { | 626 | offset = cpu_stagger_offset(smp_processor_id()); |
| 607 | case LITMUS_ALIGNED_TICKS: | ||
| 608 | offset = 0; | ||
| 609 | break; | ||
| 610 | case LITMUS_STAGGERED_TICKS: | ||
| 611 | offset = ktime_to_ns(tick_period); | ||
| 612 | do_div(offset, num_possible_cpus()); | ||
| 613 | offset *= smp_processor_id(); | ||
| 614 | break; | ||
| 615 | default: | ||
| 616 | offset = ktime_to_ns(tick_period) >> 1; | ||
| 617 | do_div(offset, num_possible_cpus()); | ||
| 618 | offset *= smp_processor_id(); | ||
| 619 | } | ||
| 620 | 627 | ||
| 621 | /* Add correct offset to expiration time. */ | 628 | /* Add correct offset to expiration time. */ |
| 622 | ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset); | 629 | ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset); |
