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

From: Shrikanth Hegde

Date: Thu Jun 04 2026 - 08:30:13 EST


Hi Prateek,

On 6/4/26 3:26 PM, K Prateek Nayak wrote:
Hello Shrikanth,
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().

IIUC stop_one_cpu_nowait expects be called with rq lock released.
So it can't be called in sched_tick with lock held.

I think it maybe okay for push_task_work_done to be done without holding rq_lock.
It might work since irq are disabled. But it is good idea to hold the lock when
changing anything in rq. Right?