* Sebastian Andrzej Siewior <[email protected]> wrote:

> On 2017-04-05 09:39:43 [+0200], Ingo Molnar wrote:
> > 
> > So maybe we could add the following facility:
> > 
> >     ptr = sched_migrate_to_cpu_save(cpu);
> > 
> >     ...
> > 
> >     sched_migrate_to_cpu_restore(ptr);

BTW., and I'm sure this has come up before, but why doesn't migrate_disable() 
use 
a simple per task flag that the scheduler migration code takes into account?

It should be functionally equivalent to the current solution, and it appears to 
have a heck of a smaller cross section with the rest of the scheduler.

I.e.:

        static inline void migrate_disable(void)
        {
                current->migration_disabled++;
        }

        ...

        static inline void migrate_enable(void)
        {
                current->migration_disabled--;
        }

or so? Then add this flag as a condition to can_migrate_task() et al.

While we generally dislike such flags as they wreck havoc with the scheduler if 
overused, the cpus_allowed based solution has the exact same effect so it's not 
like it's a step backwards - and it should also be much faster and less 
intrusive.

Am I missing some complication?

Thanks,

        Ingo

Reply via email to