Re: [PATCH v3 11/20] sched/core: Push current task from non preferred CPU

From: K Prateek Nayak

Date: Thu Jun 04 2026 - 06:04:11 EST


Hello Shrikanth,

On 6/4/2026 3:13 PM, Shrikanth Hegde wrote:
>>> +    rq->push_task_work_done = 1;
>>
>> nit.
>>
>> Apart from task_has_preferred_cpus(), all the checks above have no
>> dependency on CONFIG_PREFERRED_CPU.
>
> Code will bloat for other users. Not many may want to set CONFIG_PREFERRED_CPU=y.
> That was the reason.

Fair point. Since the config is default y, there is a good chance the
popular distros may end up keeping it enabled but it does make sense from a
point of containing the bloat to compile it out when config is disabled.

>> Can we set some local indicator in sched_tick() within the rq_lock() section
>> to then schedule the stopper once we drop the rq_lock there? That way we
>> don't have to grab the rq_lock thrice in the worst case scenario where we
>> have to schedule the stopper.
>
> I didn't get you. can you explain? how are we grabbing rq_lock thrice?

Once to set the "rq->push_task_work_done" indicator, another time to
wake up the stopper thread, and then again in sched_tick() after we
return from sched_push_current_non_preferred_cpu().

--
Thanks and Regards,
Prateek