Skip to content

Commit 3306d31

Browse files
Hugh Dickinstorvalds
authored andcommitted
mm: page_vma_mapped_walk(): use pmde for *pvmw->pmd
page_vma_mapped_walk() cleanup: re-evaluate pmde after taking lock, then use it in subsequent tests, instead of repeatedly dereferencing pointer. 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 6d0fd59 commit 3306d31

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mm/page_vma_mapped.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,19 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
191191
pmde = READ_ONCE(*pvmw->pmd);
192192
if (pmd_trans_huge(pmde) || is_pmd_migration_entry(pmde)) {
193193
pvmw->ptl = pmd_lock(mm, pvmw->pmd);
194-
if (likely(pmd_trans_huge(*pvmw->pmd))) {
194+
pmde = *pvmw->pmd;
195+
if (likely(pmd_trans_huge(pmde))) {
195196
if (pvmw->flags & PVMW_MIGRATION)
196197
return not_found(pvmw);
197-
if (pmd_page(*pvmw->pmd) != page)
198+
if (pmd_page(pmde) != page)
198199
return not_found(pvmw);
199200
return true;
200-
} else if (!pmd_present(*pvmw->pmd)) {
201+
} else if (!pmd_present(pmde)) {
201202
if (thp_migration_supported()) {
202203
if (!(pvmw->flags & PVMW_MIGRATION))
203204
return not_found(pvmw);
204-
if (is_migration_entry(pmd_to_swp_entry(*pvmw->pmd))) {
205-
swp_entry_t entry = pmd_to_swp_entry(*pvmw->pmd);
205+
if (is_migration_entry(pmd_to_swp_entry(pmde))) {
206+
swp_entry_t entry = pmd_to_swp_entry(pmde);
206207

207208
if (migration_entry_to_page(entry) != page)
208209
return not_found(pvmw);

0 commit comments

Comments
 (0)