diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0532195c38d0c94d2d5e7d70e8e8a7621f940bce..a10c4f8f47e81d87f28d37c6b74eb36d6435be42 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2110,8 +2110,8 @@ static int preferred_group_nid(struct task_struct *p, int nid) static void task_numa_placement(struct task_struct *p) { - int seq, nid, max_nid = -1, max_group_nid = -1; - unsigned long max_faults = 0, max_group_faults = 0; + int seq, nid, max_nid = -1; + unsigned long max_faults = 0; unsigned long fault_types[2] = { 0, 0 }; unsigned long total_faults; u64 runtime, period; @@ -2190,15 +2190,15 @@ static void task_numa_placement(struct task_struct *p) } } - if (faults > max_faults) { - max_faults = faults; + if (!p->numa_group) { + if (faults > max_faults) { + max_faults = faults; + max_nid = nid; + } + } else if (group_faults > max_faults) { + max_faults = group_faults; max_nid = nid; } - - if (group_faults > max_group_faults) { - max_group_faults = group_faults; - max_group_nid = nid; - } } update_task_scan_period(p, fault_types[0], fault_types[1]); @@ -2206,7 +2206,7 @@ static void task_numa_placement(struct task_struct *p) if (p->numa_group) { numa_group_count_active_nodes(p->numa_group); spin_unlock_irq(group_lock); - max_nid = preferred_group_nid(p, max_group_nid); + max_nid = preferred_group_nid(p, max_nid); } if (max_faults) {