87 lines
2.1 KiB
Diff
87 lines
2.1 KiB
Diff
From c452b6b7f53f56fe3afa64ad2a3be344157ae9da Mon Sep 17 00:00:00 2001
|
|
From: Sumit Gupta <sumitg@nvidia.com>
|
|
Date: Thu, 22 Apr 2021 10:46:11 +0530
|
|
Subject: [PATCH 370/371] Revert "BACKPORT: sched/core: Fix rules for running
|
|
on online && !active CPUs"
|
|
X-NVConfidentiality: public
|
|
|
|
This reverts commit e363fcd2ad4a5f4597f01512732204d5200cc123.
|
|
|
|
Bug 200671224
|
|
---
|
|
kernel/sched/core.c | 42 ++++++++++++------------------------------
|
|
1 file changed, 12 insertions(+), 30 deletions(-)
|
|
|
|
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
|
|
index 2178e83..553cced 100644
|
|
--- a/kernel/sched/core.c
|
|
+++ b/kernel/sched/core.c
|
|
@@ -1045,33 +1045,6 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
-
|
|
-static inline bool is_per_cpu_kthread(struct task_struct *p)
|
|
-{
|
|
- if (!(p->flags & PF_KTHREAD))
|
|
- return false;
|
|
-
|
|
- if (p->nr_cpus_allowed != 1)
|
|
- return false;
|
|
-
|
|
- return true;
|
|
-}
|
|
-
|
|
-/*
|
|
- * Per-CPU kthreads are allowed to run on !actie && online CPUs, see
|
|
- * __set_cpus_allowed_ptr() and select_fallback_rq().
|
|
- */
|
|
-static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
|
|
-{
|
|
- if (!cpumask_test_cpu(cpu, &p->cpus_allowed))
|
|
- return false;
|
|
-
|
|
- if (is_per_cpu_kthread(p))
|
|
- return cpu_online(cpu);
|
|
-
|
|
- return cpu_active(cpu);
|
|
-}
|
|
-
|
|
/*
|
|
* This is how migration works:
|
|
*
|
|
@@ -1129,8 +1102,16 @@ struct migration_arg {
|
|
*/
|
|
static struct rq *__migrate_task(struct rq *rq, struct task_struct *p, int dest_cpu)
|
|
{
|
|
+ if (p->flags & PF_KTHREAD) {
|
|
+ if (unlikely(!cpu_online(dest_cpu)))
|
|
+ return rq;
|
|
+ } else {
|
|
+ if (unlikely(!cpu_active(dest_cpu)))
|
|
+ return rq;
|
|
+ }
|
|
+
|
|
/* Affinity changed (again). */
|
|
- if (!is_cpu_allowed(p, dest_cpu))
|
|
+ if (!cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
|
|
return rq;
|
|
|
|
rq = move_queued_task(rq, p, dest_cpu);
|
|
@@ -1757,9 +1738,10 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
|
|
for (;;) {
|
|
/* Any allowed, online CPU? */
|
|
for_each_cpu(dest_cpu, tsk_cpus_allowed(p)) {
|
|
- if (!is_cpu_allowed(p, dest_cpu))
|
|
+ if (!(p->flags & PF_KTHREAD) && !cpu_active(dest_cpu))
|
|
+ continue;
|
|
+ if (!cpu_online(dest_cpu))
|
|
continue;
|
|
-
|
|
goto out;
|
|
}
|
|
|
|
--
|
|
2.7.4
|
|
|