Re: [PATCH v4 19/19] sched: Comment affine_move_task()

From: Valentin Schneider
Date: Thu Oct 29 2020 - 12:27:56 EST



On 23/10/20 11:12, Peter Zijlstra wrote:
> + * (1) In the cases covered above. There is one more where the completion is
> + * signaled within affine_move_task() itself: when a subsequent affinity request
> + * cancels the need for an active migration. Consider:
> + *
> + * Initial conditions: P0->cpus_mask = [0, 1]
> + *
> + * P0@CPU0 P1 P2
> + *
> + * migrate_disable();
> + * <preempted>
> + * set_cpus_allowed_ptr(P0, [1]);
> + * <blocks>
> + * set_cpus_allowed_ptr(P0, [0, 1]);
> + * <signal completion>
> + * <awakes>
> + *
> + * Note that the above is safe vs a concurrent migrate_enable(), as any
> + * pending affinity completion is preceded an uninstallion of
> + * p->migration_pending done with p->pi_lock held.

I too must have been thinking too much about ponies lately.

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0a3f9fd3b061..d8c85f180b09 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2147,7 +2147,7 @@ void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
* <awakes>
*
* Note that the above is safe vs a concurrent migrate_enable(), as any
- * pending affinity completion is preceded an uninstallion of
+ * pending affinity completion is preceded by an uninstallation of
* p->migration_pending done with p->pi_lock held.
*/
static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flags *rf,