Re: [PATCH 04/19] sched/numa: Set preferred_node based on best_cpu
From: Peter Zijlstra
Date: Mon Jun 04 2018 - 08:18:13 EST
On Mon, Jun 04, 2018 at 03:30:13PM +0530, Srikar Dronamraju wrote:
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ea32a66..94091e6 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1725,8 +1725,9 @@ static int task_numa_migrate(struct task_struct *p)
> * Tasks that are "trapped" in such domains cannot be migrated
> * elsewhere, so there is no point in (re)trying.
> */
> - if (unlikely(!sd)) {
> - p->numa_preferred_nid = task_node(p);
> + if (unlikely(!sd) && p->numa_preferred_nid != task_node(p)) {
> + /* Set the new preferred node */
> + sched_setnuma(p, task_node(p));
> return -EINVAL;
> }
>
That looks dodgy.. this would allow things to continue with !sd.