[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200925084339.GU2628@hirez.programming.kicks-ass.net>
Date: Fri, 25 Sep 2020 10:43:39 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Valentin Schneider <valentin.schneider@....com>
Cc: tglx@...utronix.de, mingo@...nel.org, linux-kernel@...r.kernel.org,
bigeasy@...utronix.de, qais.yousef@....com, swood@...hat.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vincent.donnefort@....com
Subject: Re: [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.
Powered by blists - more mailing lists