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.

Signed-off-by: Miaohe Lin <[email protected]>
---
 mm/swap_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/swap_state.c b/mm/swap_state.c
index ee465827420e..b9013c3f94c9 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -839,7 +839,7 @@ 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 = {1,};
 
        swap_ra_info(vmf, &ra_info);
        if (ra_info.win == 1)
-- 
2.19.1

Reply via email to