aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_stoptask.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2011-08-27 09:43:54 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2011-08-27 10:06:11 -0400
commit7b1bb388bc879ffcc6c69b567816d5c354afe42b (patch)
tree5a217fdfb0b5e5a327bdcd624506337c1ae1fe32 /kernel/sched_stoptask.c
parent7d754596756240fa918b94cd0c3011c77a638987 (diff)
parent02f8c6aee8df3cdc935e9bdd4f2d020306035dbe (diff)
Merge 'Linux v3.0' into Litmus
Some notes: * Litmus^RT scheduling class is the topmost scheduling class (above stop_sched_class). * scheduler_ipi() function (e.g., in smp_reschedule_interrupt()) may increase IPI latencies. * Added path into schedule() to quickly re-evaluate scheduling decision without becoming preemptive again. This used to be a standard path before the removal of BKL. Conflicts: Makefile arch/arm/kernel/calls.S arch/arm/kernel/smp.c arch/x86/include/asm/unistd_32.h arch/x86/kernel/smp.c arch/x86/kernel/syscall_table_32.S include/linux/hrtimer.h kernel/printk.c kernel/sched.c kernel/sched_fair.c
Diffstat (limited to 'kernel/sched_stoptask.c')
-rw-r--r--kernel/sched_stoptask.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/kernel/sched_stoptask.c b/kernel/sched_stoptask.c
new file mode 100644
index 000000000000..6f437632afab
--- /dev/null
+++ b/kernel/sched_stoptask.c
@@ -0,0 +1,104 @@
1/*
2 * stop-task scheduling class.
3 *
4 * The stop task is the highest priority task in the system, it preempts
5 * everything and will be preempted by nothing.
6 *
7 * See kernel/stop_machine.c
8 */
9
10#ifdef CONFIG_SMP
11static int
12select_task_rq_stop(struct task_struct *p, int sd_flag, int flags)
13{
14 return task_cpu(p); /* stop tasks as never migrate */
15}
16#endif /* CONFIG_SMP */
17
18static void
19check_preempt_curr_stop(struct rq *rq, struct task_struct *p, int flags)
20{
21 /* we're never preempted */
22}
23
24static struct task_struct *pick_next_task_stop(struct rq *rq)
25{
26 struct task_struct *stop = rq->stop;
27
28 if (stop && stop->on_rq)
29 return stop;
30
31 return NULL;
32}
33
34static void
35enqueue_task_stop(struct rq *rq, struct task_struct *p, int flags)
36{
37}
38
39static void
40dequeue_task_stop(struct rq *rq, struct task_struct *p, int flags)
41{
42}
43
44static void yield_task_stop(struct rq *rq)
45{
46 BUG(); /* the stop task should never yield, its pointless. */
47}
48
49static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
50{
51}
52
53static void task_tick_stop(struct rq *rq, struct task_struct *curr, int queued)
54{
55}
56
57static void set_curr_task_stop(struct rq *rq)
58{
59}
60
61static void switched_to_stop(struct rq *rq, struct task_struct *p)
62{
63 BUG(); /* its impossible to change to this class */
64}
65
66static void
67prio_changed_stop(struct rq *rq, struct task_struct *p, int oldprio)
68{
69 BUG(); /* how!?, what priority? */
70}
71
72static unsigned int
73get_rr_interval_stop(struct rq *rq, struct task_struct *task)
74{
75 return 0;
76}
77
78/*
79 * Simple, special scheduling class for the per-CPU stop tasks:
80 */
81static const struct sched_class stop_sched_class = {
82 .next = &rt_sched_class,
83
84 .enqueue_task = enqueue_task_stop,
85 .dequeue_task = dequeue_task_stop,
86 .yield_task = yield_task_stop,
87
88 .check_preempt_curr = check_preempt_curr_stop,
89
90 .pick_next_task = pick_next_task_stop,
91 .put_prev_task = put_prev_task_stop,
92
93#ifdef CONFIG_SMP
94 .select_task_rq = select_task_rq_stop,
95#endif
96
97 .set_curr_task = set_curr_task_stop,
98 .task_tick = task_tick_stop,
99
100 .get_rr_interval = get_rr_interval_stop,
101
102 .prio_changed = prio_changed_stop,
103 .switched_to = switched_to_stop,
104};