[lkml]   [2020]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 8/9] sched: Fix migrate_disable() vs set_cpus_allowed_ptr()
On Thu, Sep 24, 2020 at 08:59:33PM +0100, Valentin Schneider wrote:

> > + if (task_running(rq, p) || p->state == TASK_WAKING) {
> > +
> > + task_rq_unlock(rq, p, rf);
> > + stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg);
> > +
> Shouldn't we check for is_migrate_disabled(p) before doing any of that?
> migration_cpu_stop() does check for it, is there something that prevents us
> from acting on it earlier than that?

Since migrate_disable() / ->migration_disabled is only touched from the
current task, you can only reliably read it from the same CPU.

Hence I only look at it when the stop task has pinned the task, because
at that point I know it's stable.

Doing it earlier gives races, races give me head-aches. This is a slow
path, I don't care about performance.

 \ /
  Last update: 2020-09-25 10:44    [W:0.088 / U:3.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site