Re: [PATCH v3] sched/core: introduce sched_core_idle_cpu()
From: cruzzhao
Date: Tue Jul 11 2023 - 22:41:40 EST
在 2023/7/4 下午1:39, Aaron Lu 写道:
>> +#ifdef CONFIG_SCHED_CORE
>> +int sched_core_idle_cpu(int cpu)
>> +{
>> + struct rq *rq = cpu_rq(cpu);
>> +
>> + if (sched_core_enabled(rq) && rq->curr == rq->idle)
>> + return 1;
>
> If the intention is to consider forced idle cpus as idle, then should
> the above condition written as:
>
> if (sched_core_enabled(rq) && rq->core->core_forceidle_count)
> return 1;
> ?
>
> Or as long as a single cookied task is running, all normal idle cpus are
> regarded forced idle here and 1 is returned while previously, idle_cpu()
> is called for those cpus and if they have wakeup task pending, they are
> not regarded as idle so looks like a behaviour change.
>
> Thanks,
> Aaron
>
I'll fix this problem in the next version.
Best,
Cruz Zhao
>> +
>> + return idle_cpu(cpu);
>> +}
>> +
>> +#endif
>> +
>> #ifdef CONFIG_SMP
>> /*
>> * This function computes an effective utilization for the given CPU, to be
>> diff --git a/kernel/softirq.c b/kernel/softirq.c
>> index c8a6913c067d..98b98991ce45 100644
>> --- a/kernel/softirq.c
>> +++ b/kernel/softirq.c
>> @@ -630,7 +630,7 @@ static inline void tick_irq_exit(void)
>> int cpu = smp_processor_id();
>>
>> /* Make sure that timer wheel updates are propagated */
>> - if ((idle_cpu(cpu) && !need_resched()) || tick_nohz_full_cpu(cpu)) {
>> + if ((sched_core_idle_cpu(cpu) && !need_resched()) || tick_nohz_full_cpu(cpu)) {
>> if (!in_hardirq())
>> tick_nohz_irq_exit();
>> }
>> --
>> 2.27.0
>>