aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-04-30 16:52:23 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-04-30 16:52:23 -0400
commitf31140bd20871265106d4854b9f6c81e58bd7c48 (patch)
tree790bbf2f64880c8db69f5e54ef4f5140da08288c
parent1a229e67e4cf08a539fc558d017a95ff03705ac5 (diff)
parentc7d1f86705369bed0c65be15b898a9251de21c76 (diff)
Merge branch 'synch_quanta'
-rw-r--r--include/linux/tick.h3
-rw-r--r--kernel/time/tick-sched.c37
2 files changed, 37 insertions, 3 deletions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index f4a1395e05..7eae3585cb 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -64,6 +64,9 @@ extern int tick_is_oneshot_available(void);
64extern struct tick_device *tick_get_device(int cpu); 64extern struct tick_device *tick_get_device(int cpu);
65 65
66# ifdef CONFIG_HIGH_RES_TIMERS 66# ifdef CONFIG_HIGH_RES_TIMERS
67#define LINUX_DEFAULT_TICKS 0
68#define LITMUS_ALIGNED_TICKS 1
69#define LITMUS_STAGGERED_TICKS 2
67extern int tick_init_highres(void); 70extern int tick_init_highres(void);
68extern int tick_program_event(ktime_t expires, int force); 71extern int tick_program_event(ktime_t expires, int force);
69extern void tick_setup_sched_timer(void); 72extern void tick_setup_sched_timer(void);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index cb89fa8db1..3b1936fac0 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -568,6 +568,22 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
568} 568}
569 569
570/** 570/**
571 * tick_set_quanta_type - get the quanta type as a boot option
572 * Default is standard setup with ticks staggered over first
573 * half of tick period.
574 */
575int quanta_type = LINUX_DEFAULT_TICKS;
576static int __init tick_set_quanta_type(char *str)
577{
578 if (strcmp("aligned", str) == 0)
579 quanta_type = LITMUS_ALIGNED_TICKS;
580 else if (strcmp("staggered", str) == 0)
581 quanta_type = LITMUS_STAGGERED_TICKS;
582 return 1;
583}
584__setup("quanta=", tick_set_quanta_type);
585
586/**
571 * tick_setup_sched_timer - setup the tick emulation timer 587 * tick_setup_sched_timer - setup the tick emulation timer
572 */ 588 */
573void tick_setup_sched_timer(void) 589void tick_setup_sched_timer(void)
@@ -585,9 +601,24 @@ void tick_setup_sched_timer(void)
585 601
586 /* Get the next period (per cpu) */ 602 /* Get the next period (per cpu) */
587 ts->sched_timer.expires = tick_init_jiffy_update(); 603 ts->sched_timer.expires = tick_init_jiffy_update();
588 offset = ktime_to_ns(tick_period) >> 1; 604
589 do_div(offset, num_possible_cpus()); 605 /* Offset must be set correctly to achieve desired quanta type. */
590 offset *= smp_processor_id(); 606 switch (quanta_type) {
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
621 /* Add correct offset to expiration time. */
591 ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset); 622 ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset);
592 623
593 for (;;) { 624 for (;;) {