Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / kernel / sched_stoptask.c
CommitLineData
34f971f6
PZ
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
7608dec2 12select_task_rq_stop(struct task_struct *p, int sd_flag, int flags)
34f971f6
PZ
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{
1e5a7405 21 /* we're never preempted */
34f971f6
PZ
22}
23
24static struct task_struct *pick_next_task_stop(struct rq *rq)
25{
26 struct task_struct *stop = rq->stop;
27
fd2f4419 28 if (stop && stop->on_rq)
34f971f6
PZ
29 return stop;
30
31 return NULL;
32}
33
34static void
35enqueue_task_stop(struct rq *rq, struct task_struct *p, int flags)
36{
953bfcd1 37 inc_nr_running(rq);
34f971f6
PZ
38}
39
40static void
41dequeue_task_stop(struct rq *rq, struct task_struct *p, int flags)
42{
953bfcd1 43 dec_nr_running(rq);
34f971f6
PZ
44}
45
46static void yield_task_stop(struct rq *rq)
47{
48 BUG(); /* the stop task should never yield, its pointless. */
49}
50
51static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
52{
53}
54
55static void task_tick_stop(struct rq *rq, struct task_struct *curr, int queued)
56{
57}
58
59static void set_curr_task_stop(struct rq *rq)
60{
61}
62
da7a735e 63static void switched_to_stop(struct rq *rq, struct task_struct *p)
34f971f6
PZ
64{
65 BUG(); /* its impossible to change to this class */
66}
67
da7a735e
PZ
68static void
69prio_changed_stop(struct rq *rq, struct task_struct *p, int oldprio)
34f971f6
PZ
70{
71 BUG(); /* how!?, what priority? */
72}
73
74static unsigned int
75get_rr_interval_stop(struct rq *rq, struct task_struct *task)
76{
77 return 0;
78}
79
80/*
81 * Simple, special scheduling class for the per-CPU stop tasks:
82 */
83static const struct sched_class stop_sched_class = {
84 .next = &rt_sched_class,
85
86 .enqueue_task = enqueue_task_stop,
87 .dequeue_task = dequeue_task_stop,
88 .yield_task = yield_task_stop,
89
90 .check_preempt_curr = check_preempt_curr_stop,
91
92 .pick_next_task = pick_next_task_stop,
93 .put_prev_task = put_prev_task_stop,
94
95#ifdef CONFIG_SMP
96 .select_task_rq = select_task_rq_stop,
97#endif
98
99 .set_curr_task = set_curr_task_stop,
100 .task_tick = task_tick_stop,
101
102 .get_rr_interval = get_rr_interval_stop,
103
104 .prio_changed = prio_changed_stop,
105 .switched_to = switched_to_stop,
34f971f6 106};
This page took 0.076948 seconds and 5 git commands to generate.