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