>From be50669d38fd61259e787e337a7c82d73b42bb91 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Fri, 27 Jul 2018 17:17:01 +0900 Subject: [PATCH 2/2] swap: free allocated page if swap_read fails swap_readpage could fails by -ENOMEM. In this case, we should free allocated page instantly. There is no reason to retry. Signed-off-by: Minchan Kim --- mm/memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 7206a634270b..8a5e304ffd91 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2943,7 +2943,8 @@ int do_swap_page(struct vm_fault *vmf) __SetPageSwapBacked(page); set_page_private(page, entry.val); lru_cache_add_anon(page); - swap_readpage(page, true); + if (swap_readpage(page, true)) + goto out_page; } } else { page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE, -- 2.18.0.345.g5c9ce644c3-goog