On 11/09/20 13:29, pet...@infradead.org wrote: > On Fri, Sep 11, 2020 at 01:17:45PM +0100, Valentin Schneider wrote: > >> > @@ -6968,6 +7064,8 @@ int sched_cpu_deactivate(unsigned int cp >> > */ >> > synchronize_rcu(); >> > >> > + balance_push_set(cpu, true); >> > + >> >> IIUC this is going to make every subsequent finish_lock_switch() >> migrate the switched-to task if it isn't a pcpu kthread. So this is going >> to lead to a dance of >> >> switch_to(<task0>) -> switch_to(<stopper>) -> switch_to(<task1>) -> >> switch_to(<stopper>) ... >> >> Wouldn't it be better to batch all those in a migrate_tasks() sibling that >> skips pcpu kthreads? > > That's 'difficult', this is hotplug, performance is not a consideration. >
Aye aye. The reason I'm trying to care about this is (don't wince too hard) for that CPU pause thing [1]. Vincent's been the one doing all the actual work so I should let him pitch in, but TL;DR if we could "relatively quickly" migrate all !pcpu tasks after clearing the active bit, we could stop hotplug there and have our "CPU pause" thing. [1]: https://lwn.net/Articles/820825/ > Basically we don't have an iterator for the runqueues, so finding these > tasks is hard. Mmph right, we'd pretty much have to "enjoy" iterating & skipping pcpu threads every __pick_migrate_task() call...