Messages in this thread | | | Date | Wed, 21 Jun 2023 21:07:17 -0500 | From | David Vernet <> | Subject | Re: [RFC PATCH 1/3] sched: Make migrate_task_to() take any task |
| |
On Wed, Jun 21, 2023 at 03:04:39PM +0200, Peter Zijlstra wrote: > On Tue, Jun 13, 2023 at 12:20:02AM -0500, David Vernet wrote: > > The migrate_task_to() function exposed from kernel/sched/core.c migrates > > the current task, which is silently assumed to also be its first > > argument, to the specified CPU. The function uses stop_one_cpu() to > > migrate the task to the target CPU, which won't work if @p is not the > > current task as the stop_one_cpu() callback isn't invoked on remote > > CPUs. > > > > While this operation is useful for task_numa_migrate() in fair.c, it > > would be useful if __migrate_task() in core.c was given external > > linkage, as it actually can be used to migrate any task to a CPU. > > > > This patch therefore: > > 1. Renames the existing migrate_task_to() be called > > numa_migrate_current_task_to(). > > 2. Renames __migrate_task() to migrate_task_to(), gives it global > > linkage, and updates all callers accordingly. > > > > A follow-on patch will call the new migrate_task_to() from fair.c when > > migrating a task in a shared wakequeue to a remote CPU. > > I would suggest simply exposing move_queued_task(). You can actually do > is_cpu_allowed() before you do the whole lock dance, or even before > pull.
Good call, I'll make that improvement for v2. Also, ack on exposing move_queued_task(). That makes more sense.
> And then you don't have to create silly long function names either.
Yeah, the function name I chose is admittedly crap, but IMO it is pretty unintuitive that p == current. But yeah, it'd probably be better to just do something like remove the @p parameter and use current directly. That whole call chain passes p == current around though, so *shrug*.
| |