From: Miaohe Lin Date: Tue, 15 Dec 2020 03:06:01 +0000 (-0800) Subject: mm/swap_state: skip meaningless swap cache readahead when ra_info.win == 0 X-Git-Tag: v5.15~2223^2~151 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e97af69950ffe8be4ee12b331924b8de8a17b73e;p=platform%2Fkernel%2Flinux-starfive.git mm/swap_state: skip meaningless swap cache readahead when ra_info.win == 0 swap_ra_info() may leave ra_info untouched in non_swap_entry() case as page table lock is not held. In this case, we have ra_info.nr_pte == 0 and it is meaningless to continue with swap cache readahead. Skip such ops by init ra_info.win = 1. [akpm@linux-foundation.org: clean up struct init] Link: https://lkml.kernel.org/r/20201009133059.58407-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/swap_state.c b/mm/swap_state.c index ee46582..cf7b322 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -839,7 +839,9 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, swp_entry_t entry; unsigned int i; bool page_allocated; - struct vma_swap_readahead ra_info = {0,}; + struct vma_swap_readahead ra_info = { + .win = 1, + }; swap_ra_info(vmf, &ra_info); if (ra_info.win == 1)