Re: [PATCH v3 10/19] sched: Fix migrate_disable() vs set_cpus_allowed_ptr()
From: Valentin Schneider
Date: Mon Oct 19 2020 - 13:36:22 EST
On 19/10/20 17:32, Tao Zhou wrote:
> Hi Valentin,
>>
>> Side thought: don't we need to NULL p->migration_pending in __sched_fork()?
>>
>
> No need, if fork happen, the forked task will inherit that pending.
Which is what I'm worrying about. I think we can ignore migrate_disable()
for now and just consider a task fork()'ing while another tries to
sched_setaffinity() it; say the fork() happens just after the pending has
been installed.
Unless I'm overthinking it, we could end up with a dangling pending
reference, which will wreck havock to any later affine_move_task() (see the
if (p->migration_pending) paths).
> If pending is NULL, when call SCA, it will install pending. If pending
> is not NULL, it means it is in migrate region and wait for complete.
> If NULL pending in __sched_fork() it will install a new pending in this
> case which is not right to me. Add a flag(ENABLE_MIGRATE) to arg will
> differ the path where in.
>
> Always likely miss something.
>
> Tao
>