From: Miaohe Lin Date: Thu, 19 May 2022 21:08:50 +0000 (-0700) Subject: mm/swap: use helper is_swap_pte() in swap_vma_readahead X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=92bafb20b2edd1ab5022a9bce6fb73ed9a749453;p=linux.git mm/swap: use helper is_swap_pte() in swap_vma_readahead Patch series "A few cleanup patches for swap". This series contains a few patches to fix the comment, remove unneeded return value, use some helpers and so on. More details can be found in the respective changelogs. This patch (of 14): Use helper is_swap_pte() to check whether pte is swap entry to make code more clear. Minor readability improvement. Link: https://lkml.kernel.org/r/20220509131416.17553-1-linmiaohe@huawei.com Link: https://lkml.kernel.org/r/20220509131416.17553-2-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador Cc: Matthew Wilcox Cc: Vlastimil Babka Cc: David Howells Cc: NeilBrown Cc: Alistair Popple Cc: Suren Baghdasaryan Cc: Peter Xu Cc: Naoya Horiguchi Signed-off-by: Andrew Morton --- diff --git a/mm/swap_state.c b/mm/swap_state.c index 416aaaa8a7edc..4667fa406b143 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -818,9 +818,7 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, for (i = 0, pte = ra_info.ptes; i < ra_info.nr_pte; i++, pte++) { pentry = *pte; - if (pte_none(pentry)) - continue; - if (pte_present(pentry)) + if (!is_swap_pte(pentry)) continue; entry = pte_to_swp_entry(pentry); if (unlikely(non_swap_entry(entry)))