diff mbox series

[RFC,V1,1/6] sched/numa: Move up the access pid reset logic

Message ID aa636851c3aab82f2e5f90b0be0ba540672e8178.1693287931.git.raghavendra.kt@amd.com (mailing list archive)
State New
Headers show
Series sched/numa: Enhance disjoint VMA scanning | expand

Commit Message

Raghavendra K T Aug. 29, 2023, 6:06 a.m. UTC
otherwise VMA's access pid clearing could get deferred for
a long time when tasks return without scanning.

Suggested-by: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Raghavendra K T <raghavendra.kt@amd.com>
---
 kernel/sched/fair.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
diff mbox series

Patch

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);