hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAHJKC CVE: NA
--------------------------------
The numa_scan_seq will never update when sampling enabled, this will result in p->numa_scan_seq == seq always be true, so the task_numa_placement() will always return at the beginning, so the numa_faults and numa_group information will never update. Skip the numa_scan_seq check in the task_numa_placement() to fix this.
Fixes: bdc4701337d7 ("mm/mem_sampling.c: Drive NUMA balancing via mem_sampling access data") Signed-off-by: Nanyong Sun sunnanyong@huawei.com --- kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d22936de5714..0e47766bc591 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2405,6 +2405,8 @@ static void task_numa_placement(struct task_struct *p) spinlock_t *group_lock = NULL; struct numa_group *ng;
+ if (numa_affinity_sampling_enabled()) + goto not_scan; /* * The p->mm->numa_scan_seq field gets updated without * exclusive access. Use READ_ONCE() here to ensure @@ -2416,6 +2418,7 @@ static void task_numa_placement(struct task_struct *p) p->numa_scan_seq = seq; p->numa_scan_period_max = task_scan_max(p);
+not_scan: total_faults = p->numa_faults_locality[0] + p->numa_faults_locality[1]; runtime = numa_get_avg_runtime(p, &period);