Re: [PATCH v4 11/19] sched/core: Make migrate disable and CPU hotplug cooperative
From: Valentin Schneider
Date: Thu Oct 29 2020 - 13:55:46 EST
On 29/10/20 17:34, Peter Zijlstra wrote:
> On Thu, Oct 29, 2020 at 04:27:09PM +0000, Valentin Schneider wrote:
[...]
> Can do I suppose, although I'm no sure what, if anything that helps,
> because then we needs yet another comment explaining things.
>
> I ended up with the below. Is that an improvement?
I'm leaning towards "yes", but YMMV.
>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 3d7d5b7b9c99..c9c69511ece4 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7226,11 +7226,19 @@ static void balance_push(struct rq *rq)
> lockdep_assert_held(&rq->lock);
> SCHED_WARN_ON(rq->cpu != smp_processor_id());
>
> + /*
> + * When migrate_disable(), we'll also have nr_pinned incremented due to
> + * this being the tail end of schedule(). Therefore we do not need to wake
> + * the hotplug_wait and go straight to jail^Wexit.
> + */
> + if (is_migration_disabled(push_task))
> + return;
> +
> /*
> * Both the cpu-hotplug and stop task are in this case and are
> * required to complete the hotplug process.
> */
> - if (is_per_cpu_kthread(push_task) || is_migration_disabled(push_task)) {
> + if (is_per_cpu_kthread(push_task)) {
> /*
> * If this is the idle task on the outgoing CPU try to wake
> * up the hotplug control thread which might wait for the