Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-btrfs-devel.git] / kernel / sched_stoptask.c
blob8b44e7fa7fb355e1bb338e0df5f7bb51b2712cea
1 /*
2 * stop-task scheduling class.
4 * The stop task is the highest priority task in the system, it preempts
5 * everything and will be preempted by nothing.
7 * See kernel/stop_machine.c
8 */
10 #ifdef CONFIG_SMP
11 static int
12 select_task_rq_stop(struct task_struct *p, int sd_flag, int flags)
14 return task_cpu(p); /* stop tasks as never migrate */
16 #endif /* CONFIG_SMP */
18 static void
19 check_preempt_curr_stop(struct rq *rq, struct task_struct *p, int flags)
21 /* we're never preempted */
24 static struct task_struct *pick_next_task_stop(struct rq *rq)
26 struct task_struct *stop = rq->stop;
28 if (stop && stop->on_rq)
29 return stop;
31 return NULL;
34 static void
35 enqueue_task_stop(struct rq *rq, struct task_struct *p, int flags)
37 inc_nr_running(rq);
40 static void
41 dequeue_task_stop(struct rq *rq, struct task_struct *p, int flags)
43 dec_nr_running(rq);
46 static void yield_task_stop(struct rq *rq)
48 BUG(); /* the stop task should never yield, its pointless. */
51 static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
55 static void task_tick_stop(struct rq *rq, struct task_struct *curr, int queued)
59 static void set_curr_task_stop(struct rq *rq)
63 static void switched_to_stop(struct rq *rq, struct task_struct *p)
65 BUG(); /* its impossible to change to this class */
68 static void
69 prio_changed_stop(struct rq *rq, struct task_struct *p, int oldprio)
71 BUG(); /* how!?, what priority? */
74 static unsigned int
75 get_rr_interval_stop(struct rq *rq, struct task_struct *task)
77 return 0;
81 * Simple, special scheduling class for the per-CPU stop tasks:
83 static const struct sched_class stop_sched_class = {
84 .next = &rt_sched_class,
86 .enqueue_task = enqueue_task_stop,
87 .dequeue_task = dequeue_task_stop,
88 .yield_task = yield_task_stop,
90 .check_preempt_curr = check_preempt_curr_stop,
92 .pick_next_task = pick_next_task_stop,
93 .put_prev_task = put_prev_task_stop,
95 #ifdef CONFIG_SMP
96 .select_task_rq = select_task_rq_stop,
97 #endif
99 .set_curr_task = set_curr_task_stop,
100 .task_tick = task_tick_stop,
102 .get_rr_interval = get_rr_interval_stop,
104 .prio_changed = prio_changed_stop,
105 .switched_to = switched_to_stop,