Skip to content

Commit e2e1d40

Browse files
Hugh Dickinstorvalds
authored andcommitted
mm: page_vma_mapped_walk(): prettify PVMW_MIGRATION block
page_vma_mapped_walk() cleanup: rearrange the !pmd_present() block to follow the same "return not_found, return not_found, return true" pattern as the block above it (note: returning not_found there is never premature, since existence or prior existence of huge pmd guarantees good alignment). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Hugh Dickins <[email protected]> Acked-by: Kirill A. Shutemov <[email protected]> Reviewed-by: Peter Xu <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Ralph Campbell <[email protected]> Cc: Wang Yugui <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yang Shi <[email protected]> Cc: Zi Yan <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3306d31 commit e2e1d40

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

mm/page_vma_mapped.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,24 +198,22 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
198198
if (pmd_page(pmde) != page)
199199
return not_found(pvmw);
200200
return true;
201-
} else if (!pmd_present(pmde)) {
202-
if (thp_migration_supported()) {
203-
if (!(pvmw->flags & PVMW_MIGRATION))
204-
return not_found(pvmw);
205-
if (is_migration_entry(pmd_to_swp_entry(pmde))) {
206-
swp_entry_t entry = pmd_to_swp_entry(pmde);
201+
}
202+
if (!pmd_present(pmde)) {
203+
swp_entry_t entry;
207204

208-
if (migration_entry_to_page(entry) != page)
209-
return not_found(pvmw);
210-
return true;
211-
}
212-
}
213-
return not_found(pvmw);
214-
} else {
215-
/* THP pmd was split under us: handle on pte level */
216-
spin_unlock(pvmw->ptl);
217-
pvmw->ptl = NULL;
205+
if (!thp_migration_supported() ||
206+
!(pvmw->flags & PVMW_MIGRATION))
207+
return not_found(pvmw);
208+
entry = pmd_to_swp_entry(pmde);
209+
if (!is_migration_entry(entry) ||
210+
migration_entry_to_page(entry) != page)
211+
return not_found(pvmw);
212+
return true;
218213
}
214+
/* THP pmd was split under us: handle on pte level */
215+
spin_unlock(pvmw->ptl);
216+
pvmw->ptl = NULL;
219217
} else if (!pmd_present(pmde)) {
220218
/*
221219
* If PVMW_SYNC, take and drop THP pmd lock so that we

0 commit comments

Comments
 (0)