From e39e0ea1216ce536d0d93528a7dbac20ae3ea96f Mon Sep 17 00:00:00 2001 From: gaochao Date: Mon, 28 Nov 2022 19:28:07 +0800 Subject: [PATCH] ohos inclusion category: bugfix issue: I5XOPW CVE: NA Signed-off-by: gaochao --------------------------------------- select_task_rq_rt can not select a cpu when SCHED_RT_CAS is enable, this patch fix this --- kernel/sched/rt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index a2828aa178ed..4d2ce3afa252 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1504,6 +1504,9 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags) test = curr && unlikely(rt_task(curr)) && (curr->nr_cpus_allowed < 2 || curr->prio <= p->prio); +#ifdef CONFIG_SCHED_RT_CAS + test |= sysctl_sched_enable_rt_cas; +#endif if (test || !rt_task_fits_capacity(p, cpu)) { int target = find_lowest_rq(p); @@ -1519,8 +1522,11 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags) * Don't bother moving it if the destination CPU is * not running a lower priority task. */ - if (target != -1 && - p->prio < cpu_rq(target)->rt.highest_prio.curr) + if (target != -1 && ( +#ifdef CONFIG_SCHED_RT_CAS + sysctl_sched_enable_rt_cas || +#endif + p->prio < cpu_rq(target)->rt.highest_prio.curr)) cpu = target; } -- Gitee