[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140521164959.GI5226@laptop.programming.kicks-ass.net>
Date: Wed, 21 May 2014 18:49:59 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Sasha Levin <sasha.levin@...cle.com>
Cc: Ingo Molnar <mingo@...nel.org>, Mel Gorman <mgorman@...e.de>,
Rik van Riel <riel@...hat.com>,
Dave Jones <davej@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: sched: spinlock recursion in migrate_swap_stop
On Wed, May 21, 2014 at 03:19:48PM +0200, Peter Zijlstra wrote:
> On Wed, May 21, 2014 at 09:08:26AM -0400, Sasha Levin wrote:
> > +++ b/kernel/sched/core.c
> > @@ -1154,6 +1156,7 @@ int migrate_swap(struct task_struct *cur, struct task_struct *p)
> > goto out;
> >
> > trace_sched_swap_numa(cur, arg.src_cpu, p, arg.dst_cpu);
> > + BUG_ON(cur == p);
> > ret = stop_two_cpus(arg.dst_cpu, arg.src_cpu, migrate_swap_stop, &arg);
> >
> > out:
> >
> >
> > Which seems to get hit. This sounds like a race with task moving to
> > other cpu maybe?
>
> Oi, good call that, lemme go stare.
I think something simple like this should be sufficient to avoid the
problem of selecting oneself as a flip target.
---
kernel/sched/fair.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 28ccf502c63c..28ba71d815ee 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1115,6 +1115,8 @@ static void task_numa_compare(struct task_numa_env *env,
cur = ACCESS_ONCE(dst_rq->curr);
if (cur->pid == 0) /* idle */
cur = NULL;
+ if (cur == env->p)
+ goto unlock;
/*
* "imp" is the fault differential for the source task between the
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists