From: Hongchen Zhang Date: Tue, 10 May 2022 01:20:53 +0000 (-0700) Subject: mm/swapops: make is_pmd_migration_entry more strict X-Git-Tag: v5.19-rc1~138^2~186 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b304c6f0d39d927a87e72a8ac6c89b96ac25f355;p=thirdparty%2Fkernel%2Flinux.git mm/swapops: make is_pmd_migration_entry more strict A pmd migration entry should first be a swap pmd,so use is_swap_pmd(pmd) instead of !pmd_present(pmd). On the other hand, some architecture (MIPS for example) may misjudge a pmd_none entry as a pmd migration entry. Link: https://lkml.kernel.org/r/1651131333-6386-1-git-send-email-zhanghongchen@loongson.cn Signed-off-by: Hongchen Zhang Acked-by: Peter Xu Cc: Alistair Popple Cc: Ralph Campbell Cc: Naoya Horiguchi Cc: Hugh Dickins Signed-off-by: Andrew Morton --- diff --git a/include/linux/swapops.h b/include/linux/swapops.h index d1b728904d4ed..82265b055a0d1 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -331,7 +331,7 @@ static inline pmd_t swp_entry_to_pmd(swp_entry_t entry) static inline int is_pmd_migration_entry(pmd_t pmd) { - return !pmd_present(pmd) && is_migration_entry(pmd_to_swp_entry(pmd)); + return is_swap_pmd(pmd) && is_migration_entry(pmd_to_swp_entry(pmd)); } #else static inline int set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,