mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
pagewalk: separate function pointers from iterator data
The mm_walk structure currently mixed data and code. Split out the operations vectors into a new mm_walk_ops structure, and while we are changing the API also declare the mm_walk structure inside the walk_page_range and walk_page_vma functions. Based on patch from Linus Torvalds. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]> Reviewed-by: Steven Price <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
This commit is contained in:
parent
a520110e4a
commit
7b86ac3371
13 changed files with 251 additions and 244 deletions
23
mm/migrate.c
23
mm/migrate.c
|
|
@ -2320,6 +2320,11 @@ next:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct mm_walk_ops migrate_vma_walk_ops = {
|
||||
.pmd_entry = migrate_vma_collect_pmd,
|
||||
.pte_hole = migrate_vma_collect_hole,
|
||||
};
|
||||
|
||||
/*
|
||||
* migrate_vma_collect() - collect pages over a range of virtual addresses
|
||||
* @migrate: migrate struct containing all migration information
|
||||
|
|
@ -2331,21 +2336,15 @@ next:
|
|||
static void migrate_vma_collect(struct migrate_vma *migrate)
|
||||
{
|
||||
struct mmu_notifier_range range;
|
||||
struct mm_walk mm_walk = {
|
||||
.pmd_entry = migrate_vma_collect_pmd,
|
||||
.pte_hole = migrate_vma_collect_hole,
|
||||
.vma = migrate->vma,
|
||||
.mm = migrate->vma->vm_mm,
|
||||
.private = migrate,
|
||||
};
|
||||
|
||||
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm_walk.mm,
|
||||
migrate->start,
|
||||
migrate->end);
|
||||
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL,
|
||||
migrate->vma->vm_mm, migrate->start, migrate->end);
|
||||
mmu_notifier_invalidate_range_start(&range);
|
||||
walk_page_range(migrate->start, migrate->end, &mm_walk);
|
||||
mmu_notifier_invalidate_range_end(&range);
|
||||
|
||||
walk_page_range(migrate->vma->vm_mm, migrate->start, migrate->end,
|
||||
&migrate_vma_walk_ops, migrate);
|
||||
|
||||
mmu_notifier_invalidate_range_end(&range);
|
||||
migrate->end = migrate->start + (migrate->npages << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue