Re: [PATCH] sched: Fix get_push_task() vs migrate_disable()

From: Tao Zhou
Date: Thu Aug 26 2021 - 18:53:09 EST


Hi Thomas,

On Thu, Aug 26, 2021 at 09:38:17PM +0200, Thomas Gleixner wrote:
> Tao,
>
> On Fri, Aug 27 2021 at 00:24, Tao Zhou wrote:
> > On Thu, Aug 26, 2021 at 03:37:38PM +0200, Sebastian Andrzej Siewior wrote:
> >> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> >> index e205b63d6db07..32a4945730a9b 100644
> >> --- a/kernel/sched/sched.h
> >> +++ b/kernel/sched/sched.h
> >> @@ -2259,6 +2259,9 @@ static inline struct task_struct *get_push_task(struct rq *rq)
> >> if (p->nr_cpus_allowed == 1)
> >> return NULL;
> >>
> >> + if (p->migration_disabled)
> >> + return NULL;
> >
> > Not much I can restore here..
> >
> > Is is_migration_disabled(p) be more correct to check migration
> > disable.
>
> Kinda, but it's not an issue here because get_push_task() is only available when
> CONFIG_SMP=y which makes p->migration_disabled available as well.
>
> > And get_push_task() being called in pull_rt_task() has checked migration
> > disable first and then call get_push_task(). That means this check in
> > get_push_task() in patch is a second repeatly check.
>
> No. The checks are for two different tasks...

Aha, yes. I lost here. Thanks for your reply.

> Thanks,
>
> tglx



Thanks,
Tao