Commit 214dbc42 authored by Liam R. Howlett's avatar Liam R. Howlett Committed by Andrew Morton

sched: convert to vma iterator

Use the vma iterator so that the iterator can be invalidated or updated to
avoid each caller doing so.

Link: https://lkml.kernel.org/r/20230120162650.984577-23-Liam.Howlett@oracle.comSigned-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 250cb40f
...@@ -2938,11 +2938,11 @@ static void task_numa_work(struct callback_head *work) ...@@ -2938,11 +2938,11 @@ static void task_numa_work(struct callback_head *work)
struct task_struct *p = current; struct task_struct *p = current;
struct mm_struct *mm = p->mm; struct mm_struct *mm = p->mm;
u64 runtime = p->se.sum_exec_runtime; u64 runtime = p->se.sum_exec_runtime;
MA_STATE(mas, &mm->mm_mt, 0, 0);
struct vm_area_struct *vma; struct vm_area_struct *vma;
unsigned long start, end; unsigned long start, end;
unsigned long nr_pte_updates = 0; unsigned long nr_pte_updates = 0;
long pages, virtpages; long pages, virtpages;
struct vma_iterator vmi;
SCHED_WARN_ON(p != container_of(work, struct task_struct, numa_work)); SCHED_WARN_ON(p != container_of(work, struct task_struct, numa_work));
...@@ -2995,16 +2995,16 @@ static void task_numa_work(struct callback_head *work) ...@@ -2995,16 +2995,16 @@ static void task_numa_work(struct callback_head *work)
if (!mmap_read_trylock(mm)) if (!mmap_read_trylock(mm))
return; return;
mas_set(&mas, start); vma_iter_init(&vmi, mm, start);
vma = mas_find(&mas, ULONG_MAX); vma = vma_next(&vmi);
if (!vma) { if (!vma) {
reset_ptenuma_scan(p); reset_ptenuma_scan(p);
start = 0; start = 0;
mas_set(&mas, start); vma_iter_set(&vmi, start);
vma = mas_find(&mas, ULONG_MAX); vma = vma_next(&vmi);
} }
for (; vma; vma = mas_find(&mas, ULONG_MAX)) { do {
if (!vma_migratable(vma) || !vma_policy_mof(vma) || if (!vma_migratable(vma) || !vma_policy_mof(vma) ||
is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_MIXEDMAP)) { is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_MIXEDMAP)) {
continue; continue;
...@@ -3051,7 +3051,7 @@ static void task_numa_work(struct callback_head *work) ...@@ -3051,7 +3051,7 @@ static void task_numa_work(struct callback_head *work)
cond_resched(); cond_resched();
} while (end != vma->vm_end); } while (end != vma->vm_end);
} } for_each_vma(vmi, vma);
out: out:
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment