sched: break out early if RT task cannot be migrated
[deliverable/linux.git] / kernel / sched_rt.c
1 /*
2 * Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR
3 * policies)
4 */
5
6 #ifdef CONFIG_SMP
7 static cpumask_t rt_overload_mask;
8 static atomic_t rto_count;
9 static inline int rt_overloaded(void)
10 {
11 return atomic_read(&rto_count);
12 }
13 static inline cpumask_t *rt_overload(void)
14 {
15 return &rt_overload_mask;
16 }
17 static inline void rt_set_overload(struct rq *rq)
18 {
19 rq->rt.overloaded = 1;
20 cpu_set(rq->cpu, rt_overload_mask);
21 /*
22 * Make sure the mask is visible before we set
23 * the overload count. That is checked to determine
24 * if we should look at the mask. It would be a shame
25 * if we looked at the mask, but the mask was not
26 * updated yet.
27 */
28 wmb();
29 atomic_inc(&rto_count);
30 }
31 static inline void rt_clear_overload(struct rq *rq)
32 {
33 /* the order here really doesn't matter */
34 atomic_dec(&rto_count);
35 cpu_clear(rq->cpu, rt_overload_mask);
36 rq->rt.overloaded = 0;
37 }
38
39 static void update_rt_migration(struct rq *rq)
40 {
41 if (rq->rt.rt_nr_migratory && (rq->rt.rt_nr_running > 1))
42 rt_set_overload(rq);
43 else
44 rt_clear_overload(rq);
45 }
46 #endif /* CONFIG_SMP */
47
48 /*
49 * Update the current task's runtime statistics. Skip current tasks that
50 * are not in our scheduling class.
51 */
52 static void update_curr_rt(struct rq *rq)
53 {
54 struct task_struct *curr = rq->curr;
55 u64 delta_exec;
56
57 if (!task_has_rt_policy(curr))
58 return;
59
60 delta_exec = rq->clock - curr->se.exec_start;
61 if (unlikely((s64)delta_exec < 0))
62 delta_exec = 0;
63
64 schedstat_set(curr->se.exec_max, max(curr->se.exec_max, delta_exec));
65
66 curr->se.sum_exec_runtime += delta_exec;
67 curr->se.exec_start = rq->clock;
68 cpuacct_charge(curr, delta_exec);
69 }
70
71 static inline void inc_rt_tasks(struct task_struct *p, struct rq *rq)
72 {
73 WARN_ON(!rt_task(p));
74 rq->rt.rt_nr_running++;
75 #ifdef CONFIG_SMP
76 if (p->prio < rq->rt.highest_prio)
77 rq->rt.highest_prio = p->prio;
78 if (p->nr_cpus_allowed > 1)
79 rq->rt.rt_nr_migratory++;
80
81 update_rt_migration(rq);
82 #endif /* CONFIG_SMP */
83 }
84
85 static inline void dec_rt_tasks(struct task_struct *p, struct rq *rq)
86 {
87 WARN_ON(!rt_task(p));
88 WARN_ON(!rq->rt.rt_nr_running);
89 rq->rt.rt_nr_running--;
90 #ifdef CONFIG_SMP
91 if (rq->rt.rt_nr_running) {
92 struct rt_prio_array *array;
93
94 WARN_ON(p->prio < rq->rt.highest_prio);
95 if (p->prio == rq->rt.highest_prio) {
96 /* recalculate */
97 array = &rq->rt.active;
98 rq->rt.highest_prio =
99 sched_find_first_bit(array->bitmap);
100 } /* otherwise leave rq->highest prio alone */
101 } else
102 rq->rt.highest_prio = MAX_RT_PRIO;
103 if (p->nr_cpus_allowed > 1)
104 rq->rt.rt_nr_migratory--;
105
106 update_rt_migration(rq);
107 #endif /* CONFIG_SMP */
108 }
109
110 static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
111 {
112 struct rt_prio_array *array = &rq->rt.active;
113
114 list_add_tail(&p->run_list, array->queue + p->prio);
115 __set_bit(p->prio, array->bitmap);
116 inc_cpu_load(rq, p->se.load.weight);
117
118 inc_rt_tasks(p, rq);
119 }
120
121 /*
122 * Adding/removing a task to/from a priority array:
123 */
124 static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
125 {
126 struct rt_prio_array *array = &rq->rt.active;
127
128 update_curr_rt(rq);
129
130 list_del(&p->run_list);
131 if (list_empty(array->queue + p->prio))
132 __clear_bit(p->prio, array->bitmap);
133 dec_cpu_load(rq, p->se.load.weight);
134
135 dec_rt_tasks(p, rq);
136 }
137
138 /*
139 * Put task to the end of the run list without the overhead of dequeue
140 * followed by enqueue.
141 */
142 static void requeue_task_rt(struct rq *rq, struct task_struct *p)
143 {
144 struct rt_prio_array *array = &rq->rt.active;
145
146 list_move_tail(&p->run_list, array->queue + p->prio);
147 }
148
149 static void
150 yield_task_rt(struct rq *rq)
151 {
152 requeue_task_rt(rq, rq->curr);
153 }
154
155 #ifdef CONFIG_SMP
156 static int find_lowest_rq(struct task_struct *task);
157
158 static int select_task_rq_rt(struct task_struct *p, int sync)
159 {
160 struct rq *rq = task_rq(p);
161
162 /*
163 * If the current task is an RT task, then
164 * try to see if we can wake this RT task up on another
165 * runqueue. Otherwise simply start this RT task
166 * on its current runqueue.
167 *
168 * We want to avoid overloading runqueues. Even if
169 * the RT task is of higher priority than the current RT task.
170 * RT tasks behave differently than other tasks. If
171 * one gets preempted, we try to push it off to another queue.
172 * So trying to keep a preempting RT task on the same
173 * cache hot CPU will force the running RT task to
174 * a cold CPU. So we waste all the cache for the lower
175 * RT task in hopes of saving some of a RT task
176 * that is just being woken and probably will have
177 * cold cache anyway.
178 */
179 if (unlikely(rt_task(rq->curr)) &&
180 (p->nr_cpus_allowed > 1)) {
181 int cpu = find_lowest_rq(p);
182
183 return (cpu == -1) ? task_cpu(p) : cpu;
184 }
185
186 /*
187 * Otherwise, just let it ride on the affined RQ and the
188 * post-schedule router will push the preempted task away
189 */
190 return task_cpu(p);
191 }
192 #endif /* CONFIG_SMP */
193
194 /*
195 * Preempt the current task with a newly woken task if needed:
196 */
197 static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p)
198 {
199 if (p->prio < rq->curr->prio)
200 resched_task(rq->curr);
201 }
202
203 static struct task_struct *pick_next_task_rt(struct rq *rq)
204 {
205 struct rt_prio_array *array = &rq->rt.active;
206 struct task_struct *next;
207 struct list_head *queue;
208 int idx;
209
210 idx = sched_find_first_bit(array->bitmap);
211 if (idx >= MAX_RT_PRIO)
212 return NULL;
213
214 queue = array->queue + idx;
215 next = list_entry(queue->next, struct task_struct, run_list);
216
217 next->se.exec_start = rq->clock;
218
219 return next;
220 }
221
222 static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
223 {
224 update_curr_rt(rq);
225 p->se.exec_start = 0;
226 }
227
228 #ifdef CONFIG_SMP
229 /* Only try algorithms three times */
230 #define RT_MAX_TRIES 3
231
232 static int double_lock_balance(struct rq *this_rq, struct rq *busiest);
233 static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep);
234
235 static int pick_rt_task(struct rq *rq, struct task_struct *p, int cpu)
236 {
237 if (!task_running(rq, p) &&
238 (cpu < 0 || cpu_isset(cpu, p->cpus_allowed)) &&
239 (p->nr_cpus_allowed > 1))
240 return 1;
241 return 0;
242 }
243
244 /* Return the second highest RT task, NULL otherwise */
245 static struct task_struct *pick_next_highest_task_rt(struct rq *rq,
246 int cpu)
247 {
248 struct rt_prio_array *array = &rq->rt.active;
249 struct task_struct *next;
250 struct list_head *queue;
251 int idx;
252
253 assert_spin_locked(&rq->lock);
254
255 if (likely(rq->rt.rt_nr_running < 2))
256 return NULL;
257
258 idx = sched_find_first_bit(array->bitmap);
259 if (unlikely(idx >= MAX_RT_PRIO)) {
260 WARN_ON(1); /* rt_nr_running is bad */
261 return NULL;
262 }
263
264 queue = array->queue + idx;
265 BUG_ON(list_empty(queue));
266
267 next = list_entry(queue->next, struct task_struct, run_list);
268 if (unlikely(pick_rt_task(rq, next, cpu)))
269 goto out;
270
271 if (queue->next->next != queue) {
272 /* same prio task */
273 next = list_entry(queue->next->next, struct task_struct, run_list);
274 if (pick_rt_task(rq, next, cpu))
275 goto out;
276 }
277
278 retry:
279 /* slower, but more flexible */
280 idx = find_next_bit(array->bitmap, MAX_RT_PRIO, idx+1);
281 if (unlikely(idx >= MAX_RT_PRIO))
282 return NULL;
283
284 queue = array->queue + idx;
285 BUG_ON(list_empty(queue));
286
287 list_for_each_entry(next, queue, run_list) {
288 if (pick_rt_task(rq, next, cpu))
289 goto out;
290 }
291
292 goto retry;
293
294 out:
295 return next;
296 }
297
298 static DEFINE_PER_CPU(cpumask_t, local_cpu_mask);
299 static DEFINE_PER_CPU(cpumask_t, valid_cpu_mask);
300
301 static int find_lowest_cpus(struct task_struct *task, cpumask_t *lowest_mask)
302 {
303 int cpu;
304 cpumask_t *valid_mask = &__get_cpu_var(valid_cpu_mask);
305 int lowest_prio = -1;
306 int ret = 0;
307
308 cpus_clear(*lowest_mask);
309 cpus_and(*valid_mask, cpu_online_map, task->cpus_allowed);
310
311 /*
312 * Scan each rq for the lowest prio.
313 */
314 for_each_cpu_mask(cpu, *valid_mask) {
315 struct rq *rq = cpu_rq(cpu);
316
317 /* We look for lowest RT prio or non-rt CPU */
318 if (rq->rt.highest_prio >= MAX_RT_PRIO) {
319 if (ret)
320 cpus_clear(*lowest_mask);
321 cpu_set(rq->cpu, *lowest_mask);
322 return 1;
323 }
324
325 /* no locking for now */
326 if ((rq->rt.highest_prio > task->prio)
327 && (rq->rt.highest_prio >= lowest_prio)) {
328 if (rq->rt.highest_prio > lowest_prio) {
329 /* new low - clear old data */
330 lowest_prio = rq->rt.highest_prio;
331 cpus_clear(*lowest_mask);
332 }
333 cpu_set(rq->cpu, *lowest_mask);
334 ret = 1;
335 }
336 }
337
338 return ret;
339 }
340
341 static inline int pick_optimal_cpu(int this_cpu, cpumask_t *mask)
342 {
343 int first;
344
345 /* "this_cpu" is cheaper to preempt than a remote processor */
346 if ((this_cpu != -1) && cpu_isset(this_cpu, *mask))
347 return this_cpu;
348
349 first = first_cpu(*mask);
350 if (first != NR_CPUS)
351 return first;
352
353 return -1;
354 }
355
356 static int find_lowest_rq(struct task_struct *task)
357 {
358 struct sched_domain *sd;
359 cpumask_t *lowest_mask = &__get_cpu_var(local_cpu_mask);
360 int this_cpu = smp_processor_id();
361 int cpu = task_cpu(task);
362
363 if (!find_lowest_cpus(task, lowest_mask))
364 return -1;
365
366 /*
367 * At this point we have built a mask of cpus representing the
368 * lowest priority tasks in the system. Now we want to elect
369 * the best one based on our affinity and topology.
370 *
371 * We prioritize the last cpu that the task executed on since
372 * it is most likely cache-hot in that location.
373 */
374 if (cpu_isset(cpu, *lowest_mask))
375 return cpu;
376
377 /*
378 * Otherwise, we consult the sched_domains span maps to figure
379 * out which cpu is logically closest to our hot cache data.
380 */
381 if (this_cpu == cpu)
382 this_cpu = -1; /* Skip this_cpu opt if the same */
383
384 for_each_domain(cpu, sd) {
385 if (sd->flags & SD_WAKE_AFFINE) {
386 cpumask_t domain_mask;
387 int best_cpu;
388
389 cpus_and(domain_mask, sd->span, *lowest_mask);
390
391 best_cpu = pick_optimal_cpu(this_cpu,
392 &domain_mask);
393 if (best_cpu != -1)
394 return best_cpu;
395 }
396 }
397
398 /*
399 * And finally, if there were no matches within the domains
400 * just give the caller *something* to work with from the compatible
401 * locations.
402 */
403 return pick_optimal_cpu(this_cpu, lowest_mask);
404 }
405
406 /* Will lock the rq it finds */
407 static struct rq *find_lock_lowest_rq(struct task_struct *task,
408 struct rq *rq)
409 {
410 struct rq *lowest_rq = NULL;
411 int cpu;
412 int tries;
413
414 for (tries = 0; tries < RT_MAX_TRIES; tries++) {
415 cpu = find_lowest_rq(task);
416
417 if ((cpu == -1) || (cpu == rq->cpu))
418 break;
419
420 lowest_rq = cpu_rq(cpu);
421
422 /* if the prio of this runqueue changed, try again */
423 if (double_lock_balance(rq, lowest_rq)) {
424 /*
425 * We had to unlock the run queue. In
426 * the mean time, task could have
427 * migrated already or had its affinity changed.
428 * Also make sure that it wasn't scheduled on its rq.
429 */
430 if (unlikely(task_rq(task) != rq ||
431 !cpu_isset(lowest_rq->cpu, task->cpus_allowed) ||
432 task_running(rq, task) ||
433 !task->se.on_rq)) {
434 spin_unlock(&lowest_rq->lock);
435 lowest_rq = NULL;
436 break;
437 }
438 }
439
440 /* If this rq is still suitable use it. */
441 if (lowest_rq->rt.highest_prio > task->prio)
442 break;
443
444 /* try again */
445 spin_unlock(&lowest_rq->lock);
446 lowest_rq = NULL;
447 }
448
449 return lowest_rq;
450 }
451
452 /*
453 * If the current CPU has more than one RT task, see if the non
454 * running task can migrate over to a CPU that is running a task
455 * of lesser priority.
456 */
457 static int push_rt_task(struct rq *rq)
458 {
459 struct task_struct *next_task;
460 struct rq *lowest_rq;
461 int ret = 0;
462 int paranoid = RT_MAX_TRIES;
463
464 assert_spin_locked(&rq->lock);
465
466 if (!rq->rt.overloaded)
467 return 0;
468
469 next_task = pick_next_highest_task_rt(rq, -1);
470 if (!next_task)
471 return 0;
472
473 retry:
474 if (unlikely(next_task == rq->curr)) {
475 WARN_ON(1);
476 return 0;
477 }
478
479 /*
480 * It's possible that the next_task slipped in of
481 * higher priority than current. If that's the case
482 * just reschedule current.
483 */
484 if (unlikely(next_task->prio < rq->curr->prio)) {
485 resched_task(rq->curr);
486 return 0;
487 }
488
489 /* We might release rq lock */
490 get_task_struct(next_task);
491
492 /* find_lock_lowest_rq locks the rq if found */
493 lowest_rq = find_lock_lowest_rq(next_task, rq);
494 if (!lowest_rq) {
495 struct task_struct *task;
496 /*
497 * find lock_lowest_rq releases rq->lock
498 * so it is possible that next_task has changed.
499 * If it has, then try again.
500 */
501 task = pick_next_highest_task_rt(rq, -1);
502 if (unlikely(task != next_task) && task && paranoid--) {
503 put_task_struct(next_task);
504 next_task = task;
505 goto retry;
506 }
507 goto out;
508 }
509
510 assert_spin_locked(&lowest_rq->lock);
511
512 deactivate_task(rq, next_task, 0);
513 set_task_cpu(next_task, lowest_rq->cpu);
514 activate_task(lowest_rq, next_task, 0);
515
516 resched_task(lowest_rq->curr);
517
518 spin_unlock(&lowest_rq->lock);
519
520 ret = 1;
521 out:
522 put_task_struct(next_task);
523
524 return ret;
525 }
526
527 /*
528 * TODO: Currently we just use the second highest prio task on
529 * the queue, and stop when it can't migrate (or there's
530 * no more RT tasks). There may be a case where a lower
531 * priority RT task has a different affinity than the
532 * higher RT task. In this case the lower RT task could
533 * possibly be able to migrate where as the higher priority
534 * RT task could not. We currently ignore this issue.
535 * Enhancements are welcome!
536 */
537 static void push_rt_tasks(struct rq *rq)
538 {
539 /* push_rt_task will return true if it moved an RT */
540 while (push_rt_task(rq))
541 ;
542 }
543
544 static int pull_rt_task(struct rq *this_rq)
545 {
546 struct task_struct *next;
547 struct task_struct *p;
548 struct rq *src_rq;
549 cpumask_t *rto_cpumask;
550 int this_cpu = this_rq->cpu;
551 int cpu;
552 int ret = 0;
553
554 assert_spin_locked(&this_rq->lock);
555
556 /*
557 * If cpusets are used, and we have overlapping
558 * run queue cpusets, then this algorithm may not catch all.
559 * This is just the price you pay on trying to keep
560 * dirtying caches down on large SMP machines.
561 */
562 if (likely(!rt_overloaded()))
563 return 0;
564
565 next = pick_next_task_rt(this_rq);
566
567 rto_cpumask = rt_overload();
568
569 for_each_cpu_mask(cpu, *rto_cpumask) {
570 if (this_cpu == cpu)
571 continue;
572
573 src_rq = cpu_rq(cpu);
574 if (unlikely(src_rq->rt.rt_nr_running <= 1)) {
575 /*
576 * It is possible that overlapping cpusets
577 * will miss clearing a non overloaded runqueue.
578 * Clear it now.
579 */
580 if (double_lock_balance(this_rq, src_rq)) {
581 /* unlocked our runqueue lock */
582 struct task_struct *old_next = next;
583 next = pick_next_task_rt(this_rq);
584 if (next != old_next)
585 ret = 1;
586 }
587 if (likely(src_rq->rt.rt_nr_running <= 1))
588 /*
589 * Small chance that this_rq->curr changed
590 * but it's really harmless here.
591 */
592 rt_clear_overload(this_rq);
593 else
594 /*
595 * Heh, the src_rq is now overloaded, since
596 * we already have the src_rq lock, go straight
597 * to pulling tasks from it.
598 */
599 goto try_pulling;
600 spin_unlock(&src_rq->lock);
601 continue;
602 }
603
604 /*
605 * We can potentially drop this_rq's lock in
606 * double_lock_balance, and another CPU could
607 * steal our next task - hence we must cause
608 * the caller to recalculate the next task
609 * in that case:
610 */
611 if (double_lock_balance(this_rq, src_rq)) {
612 struct task_struct *old_next = next;
613 next = pick_next_task_rt(this_rq);
614 if (next != old_next)
615 ret = 1;
616 }
617
618 /*
619 * Are there still pullable RT tasks?
620 */
621 if (src_rq->rt.rt_nr_running <= 1) {
622 spin_unlock(&src_rq->lock);
623 continue;
624 }
625
626 try_pulling:
627 p = pick_next_highest_task_rt(src_rq, this_cpu);
628
629 /*
630 * Do we have an RT task that preempts
631 * the to-be-scheduled task?
632 */
633 if (p && (!next || (p->prio < next->prio))) {
634 WARN_ON(p == src_rq->curr);
635 WARN_ON(!p->se.on_rq);
636
637 /*
638 * There's a chance that p is higher in priority
639 * than what's currently running on its cpu.
640 * This is just that p is wakeing up and hasn't
641 * had a chance to schedule. We only pull
642 * p if it is lower in priority than the
643 * current task on the run queue or
644 * this_rq next task is lower in prio than
645 * the current task on that rq.
646 */
647 if (p->prio < src_rq->curr->prio ||
648 (next && next->prio < src_rq->curr->prio))
649 goto bail;
650
651 ret = 1;
652
653 deactivate_task(src_rq, p, 0);
654 set_task_cpu(p, this_cpu);
655 activate_task(this_rq, p, 0);
656 /*
657 * We continue with the search, just in
658 * case there's an even higher prio task
659 * in another runqueue. (low likelyhood
660 * but possible)
661 */
662
663 /*
664 * Update next so that we won't pick a task
665 * on another cpu with a priority lower (or equal)
666 * than the one we just picked.
667 */
668 next = p;
669
670 }
671 bail:
672 spin_unlock(&src_rq->lock);
673 }
674
675 return ret;
676 }
677
678 static void schedule_balance_rt(struct rq *rq,
679 struct task_struct *prev)
680 {
681 /* Try to pull RT tasks here if we lower this rq's prio */
682 if (unlikely(rt_task(prev)) &&
683 rq->rt.highest_prio > prev->prio)
684 pull_rt_task(rq);
685 }
686
687 static void schedule_tail_balance_rt(struct rq *rq)
688 {
689 /*
690 * If we have more than one rt_task queued, then
691 * see if we can push the other rt_tasks off to other CPUS.
692 * Note we may release the rq lock, and since
693 * the lock was owned by prev, we need to release it
694 * first via finish_lock_switch and then reaquire it here.
695 */
696 if (unlikely(rq->rt.overloaded)) {
697 spin_lock_irq(&rq->lock);
698 push_rt_tasks(rq);
699 spin_unlock_irq(&rq->lock);
700 }
701 }
702
703
704 static void wakeup_balance_rt(struct rq *rq, struct task_struct *p)
705 {
706 if (unlikely(rt_task(p)) &&
707 !task_running(rq, p) &&
708 (p->prio >= rq->rt.highest_prio) &&
709 rq->rt.overloaded)
710 push_rt_tasks(rq);
711 }
712
713 static unsigned long
714 load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
715 unsigned long max_load_move,
716 struct sched_domain *sd, enum cpu_idle_type idle,
717 int *all_pinned, int *this_best_prio)
718 {
719 /* don't touch RT tasks */
720 return 0;
721 }
722
723 static int
724 move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
725 struct sched_domain *sd, enum cpu_idle_type idle)
726 {
727 /* don't touch RT tasks */
728 return 0;
729 }
730 static void set_cpus_allowed_rt(struct task_struct *p, cpumask_t *new_mask)
731 {
732 int weight = cpus_weight(*new_mask);
733
734 BUG_ON(!rt_task(p));
735
736 /*
737 * Update the migration status of the RQ if we have an RT task
738 * which is running AND changing its weight value.
739 */
740 if (p->se.on_rq && (weight != p->nr_cpus_allowed)) {
741 struct rq *rq = task_rq(p);
742
743 if ((p->nr_cpus_allowed <= 1) && (weight > 1))
744 rq->rt.rt_nr_migratory++;
745 else if((p->nr_cpus_allowed > 1) && (weight <= 1)) {
746 BUG_ON(!rq->rt.rt_nr_migratory);
747 rq->rt.rt_nr_migratory--;
748 }
749
750 update_rt_migration(rq);
751 }
752
753 p->cpus_allowed = *new_mask;
754 p->nr_cpus_allowed = weight;
755 }
756 #else /* CONFIG_SMP */
757 # define schedule_tail_balance_rt(rq) do { } while (0)
758 # define schedule_balance_rt(rq, prev) do { } while (0)
759 # define wakeup_balance_rt(rq, p) do { } while (0)
760 #endif /* CONFIG_SMP */
761
762 static void task_tick_rt(struct rq *rq, struct task_struct *p)
763 {
764 update_curr_rt(rq);
765
766 /*
767 * RR tasks need a special form of timeslice management.
768 * FIFO tasks have no timeslices.
769 */
770 if (p->policy != SCHED_RR)
771 return;
772
773 if (--p->time_slice)
774 return;
775
776 p->time_slice = DEF_TIMESLICE;
777
778 /*
779 * Requeue to the end of queue if we are not the only element
780 * on the queue:
781 */
782 if (p->run_list.prev != p->run_list.next) {
783 requeue_task_rt(rq, p);
784 set_tsk_need_resched(p);
785 }
786 }
787
788 static void set_curr_task_rt(struct rq *rq)
789 {
790 struct task_struct *p = rq->curr;
791
792 p->se.exec_start = rq->clock;
793 }
794
795 const struct sched_class rt_sched_class = {
796 .next = &fair_sched_class,
797 .enqueue_task = enqueue_task_rt,
798 .dequeue_task = dequeue_task_rt,
799 .yield_task = yield_task_rt,
800 #ifdef CONFIG_SMP
801 .select_task_rq = select_task_rq_rt,
802 #endif /* CONFIG_SMP */
803
804 .check_preempt_curr = check_preempt_curr_rt,
805
806 .pick_next_task = pick_next_task_rt,
807 .put_prev_task = put_prev_task_rt,
808
809 #ifdef CONFIG_SMP
810 .load_balance = load_balance_rt,
811 .move_one_task = move_one_task_rt,
812 .set_cpus_allowed = set_cpus_allowed_rt,
813 #endif
814
815 .set_curr_task = set_curr_task_rt,
816 .task_tick = task_tick_rt,
817 };
This page took 0.106417 seconds and 6 git commands to generate.