rt.c (2ac5e38ea4203852d6e99edd3cf11f044b0a409f) | rt.c (9ebc6053814d37b9de8cc291fba28f30a729c929) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR 4 * policies) 5 */ 6#include "sched.h" 7 8#include "pelt.h" --- 1484 unchanged lines hidden (view full) --- 1493 * to move current somewhere else, making room for our non-migratable 1494 * task. 1495 */ 1496 if (p->prio == rq->curr->prio && !test_tsk_need_resched(rq->curr)) 1497 check_preempt_equal_prio(rq, p); 1498#endif 1499} 1500 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR 4 * policies) 5 */ 6#include "sched.h" 7 8#include "pelt.h" --- 1484 unchanged lines hidden (view full) --- 1493 * to move current somewhere else, making room for our non-migratable 1494 * task. 1495 */ 1496 if (p->prio == rq->curr->prio && !test_tsk_need_resched(rq->curr)) 1497 check_preempt_equal_prio(rq, p); 1498#endif 1499} 1500 |
1501static inline void set_next_task(struct rq *rq, struct task_struct *p) 1502{ 1503 p->se.exec_start = rq_clock_task(rq); 1504 1505 /* The running task is never eligible for pushing */ 1506 dequeue_pushable_task(rq, p); 1507} 1508 |
|
1501static struct sched_rt_entity *pick_next_rt_entity(struct rq *rq, 1502 struct rt_rq *rt_rq) 1503{ 1504 struct rt_prio_array *array = &rt_rq->active; 1505 struct sched_rt_entity *next = NULL; 1506 struct list_head *queue; 1507 int idx; 1508 --- 4 unchanged lines hidden (view full) --- 1513 next = list_entry(queue->next, struct sched_rt_entity, run_list); 1514 1515 return next; 1516} 1517 1518static struct task_struct *_pick_next_task_rt(struct rq *rq) 1519{ 1520 struct sched_rt_entity *rt_se; | 1509static struct sched_rt_entity *pick_next_rt_entity(struct rq *rq, 1510 struct rt_rq *rt_rq) 1511{ 1512 struct rt_prio_array *array = &rt_rq->active; 1513 struct sched_rt_entity *next = NULL; 1514 struct list_head *queue; 1515 int idx; 1516 --- 4 unchanged lines hidden (view full) --- 1521 next = list_entry(queue->next, struct sched_rt_entity, run_list); 1522 1523 return next; 1524} 1525 1526static struct task_struct *_pick_next_task_rt(struct rq *rq) 1527{ 1528 struct sched_rt_entity *rt_se; |
1521 struct task_struct *p; | |
1522 struct rt_rq *rt_rq = &rq->rt; 1523 1524 do { 1525 rt_se = pick_next_rt_entity(rq, rt_rq); 1526 BUG_ON(!rt_se); 1527 rt_rq = group_rt_rq(rt_se); 1528 } while (rt_rq); 1529 | 1529 struct rt_rq *rt_rq = &rq->rt; 1530 1531 do { 1532 rt_se = pick_next_rt_entity(rq, rt_rq); 1533 BUG_ON(!rt_se); 1534 rt_rq = group_rt_rq(rt_se); 1535 } while (rt_rq); 1536 |
1530 p = rt_task_of(rt_se); 1531 p->se.exec_start = rq_clock_task(rq); 1532 1533 return p; | 1537 return rt_task_of(rt_se); |
1534} 1535 1536static struct task_struct * 1537pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) 1538{ 1539 struct task_struct *p; 1540 struct rt_rq *rt_rq = &rq->rt; 1541 --- 26 unchanged lines hidden (view full) --- 1568 1569 if (!rt_rq->rt_queued) 1570 return NULL; 1571 1572 put_prev_task(rq, prev); 1573 1574 p = _pick_next_task_rt(rq); 1575 | 1538} 1539 1540static struct task_struct * 1541pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) 1542{ 1543 struct task_struct *p; 1544 struct rt_rq *rt_rq = &rq->rt; 1545 --- 26 unchanged lines hidden (view full) --- 1572 1573 if (!rt_rq->rt_queued) 1574 return NULL; 1575 1576 put_prev_task(rq, prev); 1577 1578 p = _pick_next_task_rt(rq); 1579 |
1576 /* The running task is never eligible for pushing */ 1577 dequeue_pushable_task(rq, p); | 1580 set_next_task(rq, p); |
1578 1579 rt_queue_push_tasks(rq); 1580 1581 /* 1582 * If prev task was rt, put_prev_task() has already updated the 1583 * utilization. We only care of the case where we start to schedule a 1584 * rt task 1585 */ --- 219 unchanged lines hidden (view full) --- 1805 if (!rq->rt.overloaded) 1806 return 0; 1807 1808 next_task = pick_next_pushable_task(rq); 1809 if (!next_task) 1810 return 0; 1811 1812retry: | 1581 1582 rt_queue_push_tasks(rq); 1583 1584 /* 1585 * If prev task was rt, put_prev_task() has already updated the 1586 * utilization. We only care of the case where we start to schedule a 1587 * rt task 1588 */ --- 219 unchanged lines hidden (view full) --- 1808 if (!rq->rt.overloaded) 1809 return 0; 1810 1811 next_task = pick_next_pushable_task(rq); 1812 if (!next_task) 1813 return 0; 1814 1815retry: |
1813 if (unlikely(next_task == rq->curr)) { 1814 WARN_ON(1); | 1816 if (WARN_ON(next_task == rq->curr)) |
1815 return 0; | 1817 return 0; |
1816 } | |
1817 1818 /* 1819 * It's possible that the next_task slipped in of 1820 * higher priority than current. If that's the case 1821 * just reschedule current. 1822 */ 1823 if (unlikely(next_task->prio < rq->curr->prio)) { 1824 resched_curr(rq); --- 525 unchanged lines hidden (view full) --- 2350 resched_curr(rq); 2351 return; 2352 } 2353 } 2354} 2355 2356static void set_curr_task_rt(struct rq *rq) 2357{ | 1818 1819 /* 1820 * It's possible that the next_task slipped in of 1821 * higher priority than current. If that's the case 1822 * just reschedule current. 1823 */ 1824 if (unlikely(next_task->prio < rq->curr->prio)) { 1825 resched_curr(rq); --- 525 unchanged lines hidden (view full) --- 2351 resched_curr(rq); 2352 return; 2353 } 2354 } 2355} 2356 2357static void set_curr_task_rt(struct rq *rq) 2358{ |
2358 struct task_struct *p = rq->curr; 2359 2360 p->se.exec_start = rq_clock_task(rq); 2361 2362 /* The running task is never eligible for pushing */ 2363 dequeue_pushable_task(rq, p); | 2359 set_next_task(rq, rq->curr); |
2364} 2365 2366static unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task) 2367{ 2368 /* 2369 * Time slice is 0 for SCHED_FIFO tasks 2370 */ 2371 if (task->policy == SCHED_RR) --- 360 unchanged lines hidden --- | 2360} 2361 2362static unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task) 2363{ 2364 /* 2365 * Time slice is 0 for SCHED_FIFO tasks 2366 */ 2367 if (task->policy == SCHED_RR) --- 360 unchanged lines hidden --- |