When the current running task is pushed using stop class mechanism, the
new CPU that going to be chosen shouldn't be a parked CPU.
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
kernel/sched/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 62b3416f5e43..9ec12f9b3b08 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3526,7 +3526,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
nodemask = cpumask_of_node(nid);
/* Look for allowed, online CPU in same node. */
- for_each_cpu(dest_cpu, nodemask) {
+ for_each_cpu_andnot(dest_cpu, nodemask, cpu_parked_mask) {
if (is_cpu_allowed(p, dest_cpu))
return dest_cpu;
}
@@ -3534,7 +3534,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
for (;;) {
/* Any allowed, online CPU? */
- for_each_cpu(dest_cpu, p->cpus_ptr) {
+ for_each_cpu_andnot(dest_cpu, p->cpus_ptr, cpu_parked_mask) {
if (!is_cpu_allowed(p, dest_cpu))
continue;
--
2.39.3
On Fri, May 23, 2025 at 11:44:45PM +0530, Shrikanth Hegde wrote:
> When the current running task is pushed using stop class mechanism, the
> new CPU that going to be chosen shouldn't be a parked CPU.
>
> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> ---
> kernel/sched/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 62b3416f5e43..9ec12f9b3b08 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3526,7 +3526,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
> nodemask = cpumask_of_node(nid);
>
> /* Look for allowed, online CPU in same node. */
> - for_each_cpu(dest_cpu, nodemask) {
> + for_each_cpu_andnot(dest_cpu, nodemask, cpu_parked_mask) {
> if (is_cpu_allowed(p, dest_cpu))
> return dest_cpu;
> }
> @@ -3534,7 +3534,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
>
> for (;;) {
> /* Any allowed, online CPU? */
> - for_each_cpu(dest_cpu, p->cpus_ptr) {
> + for_each_cpu_andnot(dest_cpu, p->cpus_ptr, cpu_parked_mask) {
> if (!is_cpu_allowed(p, dest_cpu))
> continue;
You test for online and dying CPUs in the is_cpu_allowed(). Why this
new 'parked' creature is different?
On 5/27/25 20:29, Yury Norov wrote:
> On Fri, May 23, 2025 at 11:44:45PM +0530, Shrikanth Hegde wrote:
>> When the current running task is pushed using stop class mechanism, the
>> new CPU that going to be chosen shouldn't be a parked CPU.
>>
>> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
>> ---
>> kernel/sched/core.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 62b3416f5e43..9ec12f9b3b08 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -3526,7 +3526,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
>> nodemask = cpumask_of_node(nid);
>>
>> /* Look for allowed, online CPU in same node. */
>> - for_each_cpu(dest_cpu, nodemask) {
>> + for_each_cpu_andnot(dest_cpu, nodemask, cpu_parked_mask) {
>> if (is_cpu_allowed(p, dest_cpu))
>> return dest_cpu;
>> }
>> @@ -3534,7 +3534,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
>>
>> for (;;) {
>> /* Any allowed, online CPU? */
>> - for_each_cpu(dest_cpu, p->cpus_ptr) {
>> + for_each_cpu_andnot(dest_cpu, p->cpus_ptr, cpu_parked_mask) {
>> if (!is_cpu_allowed(p, dest_cpu))
>> continue;
>
> You test for online and dying CPUs in the is_cpu_allowed(). Why this
> new 'parked' creature is different?
Agreed. Let me try move that logic into is_cpu_allowed.
© 2016 - 2025 Red Hat, Inc.