diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-02-03 11:40:17 -0500 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-03-21 12:59:02 -0400 |
commit | 2aff7a4755bed2870ee23b75bc88cdc8d76cdd03 (patch) | |
tree | a638ee31555747a2252b02e87440dfa303b9f64e /mm/migrate.c | |
parent | aef13dec0a5fa3c4adc8949307fc8d8aac7337df (diff) | |
download | linux-stable-2aff7a4755bed2870ee23b75bc88cdc8d76cdd03.tar.gz linux-stable-2aff7a4755bed2870ee23b75bc88cdc8d76cdd03.tar.bz2 linux-stable-2aff7a4755bed2870ee23b75bc88cdc8d76cdd03.zip |
mm: Convert page_vma_mapped_walk to work on PFNs
page_mapped_in_vma() really just wants to walk one page, but as the
code stands, if passed the head page of a compound page, it will
walk every page in the compound page. Extract pfn/nr_pages/pgoff
from the struct page early, so they can be overridden by
page_mapped_in_vma().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm/migrate.c')
-rw-r--r-- | mm/migrate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index 71f92e8ed934..358bc311caaa 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -174,7 +174,8 @@ void putback_movable_pages(struct list_head *l) static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, unsigned long addr, void *old) { - DEFINE_PAGE_VMA_WALK(pvmw, old, vma, addr, PVMW_SYNC | PVMW_MIGRATION); + DEFINE_PAGE_VMA_WALK(pvmw, (struct page *)old, vma, addr, + PVMW_SYNC | PVMW_MIGRATION); struct page *new; pte_t pte; swp_entry_t entry; @@ -184,7 +185,7 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, if (PageKsm(page)) new = page; else - new = page - pvmw.page->index + + new = page - pvmw.pgoff + linear_page_index(vma, pvmw.address); #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION |