[RFC PATCH V1 1/6] sched/numa: Move up the access pid reset logic
From: Raghavendra K T
Date: Tue Aug 29 2023 - 02:08:17 EST
otherwise VMA's access pid clearing could get deferred for
a long time when tasks return without scanning.
Suggested-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Raghavendra K T <raghavendra.kt@xxxxxxx>
---
kernel/sched/fair.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b3e25be58e2b..2f2e1568c1d4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3068,14 +3068,7 @@ static void task_numa_work(struct callback_head *work)
vma->numab_state->next_scan))
continue;
- /* Do not scan the VMA if task has not accessed */
- if (!vma_is_accessed(vma))
- continue;
-
- /*
- * RESET access PIDs regularly for old VMAs. Resetting after checking
- * vma for recent access to avoid clearing PID info before access..
- */
+ /* RESET access PIDs regularly for old VMAs. */
if (mm->numa_scan_seq &&
time_after(jiffies, vma->numab_state->next_pid_reset)) {
vma->numab_state->next_pid_reset = vma->numab_state->next_pid_reset +
@@ -3084,6 +3077,10 @@ static void task_numa_work(struct callback_head *work)
vma->numab_state->access_pids[1] = 0;
}
+ /* Do not scan the VMA if task has not accessed */
+ if (!vma_is_accessed(vma))
+ continue;
+
do {
start = max(start, vma->vm_start);
end = ALIGN(start + (pages << PAGE_SHIFT), HPAGE_SIZE);
--
2.34.1