rt.c (a3479c7fc096a1a7a2dccbfbdc6fcf86b805711a) rt.c (f3d133ee0a17d5694c6f21873eec9863e11fa423)
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
8int sched_rr_timeslice = RR_TIMESLICE;

--- 494 unchanged lines hidden (view full) ---

503
504static void sched_rt_rq_dequeue(struct rt_rq *rt_rq)
505{
506 struct sched_rt_entity *rt_se;
507 int cpu = cpu_of(rq_of_rt_rq(rt_rq));
508
509 rt_se = rt_rq->tg->rt_se[cpu];
510
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
8int sched_rr_timeslice = RR_TIMESLICE;

--- 494 unchanged lines hidden (view full) ---

503
504static void sched_rt_rq_dequeue(struct rt_rq *rt_rq)
505{
506 struct sched_rt_entity *rt_se;
507 int cpu = cpu_of(rq_of_rt_rq(rt_rq));
508
509 rt_se = rt_rq->tg->rt_se[cpu];
510
511 if (!rt_se)
511 if (!rt_se) {
512 dequeue_top_rt_rq(rt_rq);
512 dequeue_top_rt_rq(rt_rq);
513 /* Kick cpufreq (see the comment in kernel/sched/sched.h). */
514 cpufreq_update_util(rq_of_rt_rq(rt_rq), 0);
515 }
513 else if (on_rt_rq(rt_se))
514 dequeue_rt_entity(rt_se, 0);
515}
516
517static inline int rt_rq_throttled(struct rt_rq *rt_rq)
518{
519 return rt_rq->rt_throttled && !rt_rq->rt_nr_boosted;
520}

--- 307 unchanged lines hidden (view full) ---

828 struct rq *rq = rq_of_rt_rq(rt_rq);
829 int skip;
830
831 /*
832 * When span == cpu_online_mask, taking each rq->lock
833 * can be time-consuming. Try to avoid it when possible.
834 */
835 raw_spin_lock(&rt_rq->rt_runtime_lock);
516 else if (on_rt_rq(rt_se))
517 dequeue_rt_entity(rt_se, 0);
518}
519
520static inline int rt_rq_throttled(struct rt_rq *rt_rq)
521{
522 return rt_rq->rt_throttled && !rt_rq->rt_nr_boosted;
523}

--- 307 unchanged lines hidden (view full) ---

831 struct rq *rq = rq_of_rt_rq(rt_rq);
832 int skip;
833
834 /*
835 * When span == cpu_online_mask, taking each rq->lock
836 * can be time-consuming. Try to avoid it when possible.
837 */
838 raw_spin_lock(&rt_rq->rt_runtime_lock);
839 if (!sched_feat(RT_RUNTIME_SHARE) && rt_rq->rt_runtime != RUNTIME_INF)
840 rt_rq->rt_runtime = rt_b->rt_runtime;
836 skip = !rt_rq->rt_time && !rt_rq->rt_nr_running;
837 raw_spin_unlock(&rt_rq->rt_runtime_lock);
838 if (skip)
839 continue;
840
841 raw_spin_lock(&rq->lock);
842 update_rq_clock(rq);
843

--- 152 unchanged lines hidden (view full) ---

996 if (!rt_rq->rt_queued)
997 return;
998
999 BUG_ON(!rq->nr_running);
1000
1001 sub_nr_running(rq, rt_rq->rt_nr_running);
1002 rt_rq->rt_queued = 0;
1003
841 skip = !rt_rq->rt_time && !rt_rq->rt_nr_running;
842 raw_spin_unlock(&rt_rq->rt_runtime_lock);
843 if (skip)
844 continue;
845
846 raw_spin_lock(&rq->lock);
847 update_rq_clock(rq);
848

--- 152 unchanged lines hidden (view full) ---

1001 if (!rt_rq->rt_queued)
1002 return;
1003
1004 BUG_ON(!rq->nr_running);
1005
1006 sub_nr_running(rq, rt_rq->rt_nr_running);
1007 rt_rq->rt_queued = 0;
1008
1004 /* Kick cpufreq (see the comment in kernel/sched/sched.h). */
1005 cpufreq_update_util(rq, 0);
1006}
1007
1008static void
1009enqueue_top_rt_rq(struct rt_rq *rt_rq)
1010{
1011 struct rq *rq = rq_of_rt_rq(rt_rq);
1012
1013 BUG_ON(&rq->rt != rt_rq);
1014
1015 if (rt_rq->rt_queued)
1016 return;
1009}
1010
1011static void
1012enqueue_top_rt_rq(struct rt_rq *rt_rq)
1013{
1014 struct rq *rq = rq_of_rt_rq(rt_rq);
1015
1016 BUG_ON(&rq->rt != rt_rq);
1017
1018 if (rt_rq->rt_queued)
1019 return;
1017 if (rt_rq_throttled(rt_rq) || !rt_rq->rt_nr_running)
1020
1021 if (rt_rq_throttled(rt_rq))
1018 return;
1019
1022 return;
1023
1020 add_nr_running(rq, rt_rq->rt_nr_running);
1021 rt_rq->rt_queued = 1;
1024 if (rt_rq->rt_nr_running) {
1025 add_nr_running(rq, rt_rq->rt_nr_running);
1026 rt_rq->rt_queued = 1;
1027 }
1022
1023 /* Kick cpufreq (see the comment in kernel/sched/sched.h). */
1024 cpufreq_update_util(rq, 0);
1025}
1026
1027#if defined CONFIG_SMP
1028
1029static void

--- 1685 unchanged lines hidden ---
1028
1029 /* Kick cpufreq (see the comment in kernel/sched/sched.h). */
1030 cpufreq_update_util(rq, 0);
1031}
1032
1033#if defined CONFIG_SMP
1034
1035static void

--- 1685 unchanged lines hidden ---