lkml.org 
[lkml]   [2018]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 16/19] sched/numa: Detect if node actively handling migration
From
Date
On Mon, 2018-06-04 at 20:56 -0700, Srikar Dronamraju wrote:
> * Rik van Riel <riel@surriel.com> [2018-06-04 16:05:55]:
>
> > On Mon, 2018-06-04 at 15:30 +0530, Srikar Dronamraju wrote:
> >
> > > @@ -1554,6 +1562,9 @@ static void task_numa_compare(struct
> > > task_numa_env *env,
> > > if (READ_ONCE(dst_rq->numa_migrate_on))
> > > return;
> > >
> > > + if (*move && READ_ONCE(pgdat->active_node_migrate))
> > > + *move = false;
> >
> > Why not do this check in task_numa_find_cpu?
> >
> > That way you won't have to pass this in as a
> > pointer, and you also will not have to recalculate
> > NODE_DATA(cpu_to_node(env->dst_cpu)) for every CPU.
> >
>
> I thought about this. Lets say we evaluated that destination node can
> allow movement. While we iterate through the list of cpus trying to
> find
> the best cpu node, we find a idle cpu towards the end of the list.
> However if another task as already raced with us to move a task to
> this
> node, then we should bail out. Keeping the check in task_numa_compare
> will allow us to do this.

Your check is called once for every invocation
of task_numa_compare. It does not matter whether
it is inside or outside, except on the outside
the variable manipulation will be easier to read.

> > > + * task migration might only result in ping pong
> > > + * of tasks and also hurt performance due to cache
> > > + * misses.
> > > + */
> > > + if (imp < SMALLIMP || imp <= env->best_imp + SMALLIMP /
> > > 2)
> > > + goto unlock;
> >
> > I can see a use for the first test, but why limit the
> > search for the best score once you are past the
> > threshold?
> >
> > I don't understand the use for that second test.
> >
>
> Lets say few threads are racing with each other to find a cpu on the
> node. The first thread has already found a task/cpu 'A' to swap and
> finds another task/cpu 'B' thats slightly better than the current
> best_cpu which is 'A'. Currently we allow the second task/cpu 'B' to
> be
> set as best_cpu. However the second or subsequent threads cannot find
> the first task/cpu A because its suppose to be in active migration.
> By
> the time it reaches task/cpu B even that may look to be in active
> migration. It may never know that task/cpu A was cleared. In this
> way,
> the second and subsequent threads may not get a task/cpu in the
> preferred node to swap just because the first task kept hopping
> task/cpu
> as its choice of migration.
>
> While we can't complete avoid this, the second check will try to make
> sure we don't hop on/hop off just for small incremental numa
> improvement.

However, all those racing tasks start searching
the CPUs on a node from the same start position.

That means they may all get stuck on the same
task/cpu A, and not select the better task/cpu B.

What am I missing?

--
All Rights Reversed.[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-06-05 15:08    [W:0.063 / U:34.932 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site