Re: [PATCH 08/11] sched/numa: Bias swapping tasks based on their preferred node

From: Mel Gorman
Date: Fri Feb 14 2020 - 02:50:51 EST


On Fri, Feb 14, 2020 at 12:12:32PM +0800, Hillf Danton wrote:
> > + if (cur->numa_preferred_nid == env->dst_nid)
> > + imp -= imp / 16;
> > +
> > + /*
> > + * Encourage picking a task that moves to its preferred node.
> > + * This potentially makes imp larger than it's maximum of
> > + * 1998 (see SMALLIMP and task_weight for why) but in this
> > + * case, it does not matter.
> > + */
> > + if (cur->numa_preferred_nid == env->src_nid)
> > + imp += imp / 8;
> > +
> > if (maymove && moveimp > imp && moveimp > env->best_imp) {
> > imp = moveimp;
> > cur = NULL;
> > goto assign;
> > }
> >
> > + /*
> > + * If a swap is required then prefer moving a task to its preferred
> > + * nid over a task that is not moving to a preferred nid.
>
> after checking if imp is above SMALLIMP.
>

It is preferable to move a task to its preferred node over one that
does not even if the improvement is lsss than SMALLIMP. The reasoning is
that NUMA balancing retries moving tasks to their preferred node
periodically and moving "now" reduces the chance of a task having to
retry its move later.

--
Mel Gorman
SUSE Labs