Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344798
b: refs/heads/master
c: 9f40604
h: refs/heads/master
v: v3
  • Loading branch information
Mel Gorman committed Dec 11, 2012
1 parent e5c56d9 commit e091701
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e5fb223e89dbe5cb5c563f8d4a4a0a7d62455a8
refs/heads/master: 9f40604cdab935e80db57b309c48659de349d4e6
36 changes: 21 additions & 15 deletions trunk/kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,8 @@ void task_numa_work(struct callback_head *work)
struct task_struct *p = current;
struct mm_struct *mm = p->mm;
struct vm_area_struct *vma;
unsigned long offset, end;
long length;
unsigned long start, end;
long pages;

WARN_ON_ONCE(p != container_of(work, struct task_struct, numa_work));

Expand Down Expand Up @@ -858,42 +858,48 @@ void task_numa_work(struct callback_head *work)
if (cmpxchg(&mm->numa_next_scan, migrate, next_scan) != migrate)
return;

offset = mm->numa_scan_offset;
length = sysctl_numa_balancing_scan_size;
length <<= 20;
start = mm->numa_scan_offset;
pages = sysctl_numa_balancing_scan_size;
pages <<= 20 - PAGE_SHIFT; /* MB in pages */
if (!pages)
return;

down_read(&mm->mmap_sem);
vma = find_vma(mm, offset);
vma = find_vma(mm, start);
if (!vma) {
reset_ptenuma_scan(p);
offset = 0;
start = 0;
vma = mm->mmap;
}
for (; vma && length > 0; vma = vma->vm_next) {
for (; vma; vma = vma->vm_next) {
if (!vma_migratable(vma))
continue;

/* Skip small VMAs. They are not likely to be of relevance */
if (((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) < HPAGE_PMD_NR)
continue;

offset = max(offset, vma->vm_start);
end = min(ALIGN(offset + length, HPAGE_SIZE), vma->vm_end);
length -= end - offset;

change_prot_numa(vma, offset, end);
do {
start = max(start, vma->vm_start);
end = ALIGN(start + (pages << PAGE_SHIFT), HPAGE_SIZE);
end = min(end, vma->vm_end);
pages -= change_prot_numa(vma, start, end);

offset = end;
start = end;
if (pages <= 0)
goto out;
} while (end != vma->vm_end);
}

out:
/*
* It is possible to reach the end of the VMA list but the last few VMAs are
* not guaranteed to the vma_migratable. If they are not, we would find the
* !migratable VMA on the next scan but not reset the scanner to the start
* so check it now.
*/
if (vma)
mm->numa_scan_offset = offset;
mm->numa_scan_offset = start;
else
reset_ptenuma_scan(p);
up_read(&mm->mmap_sem);
Expand Down

0 comments on commit e091701

Please sign in to comment.