From: NeilBrown <neilb@suse.de>
Date: Fri, 29 Oct 2021 13:35:56 +1100
Subject: [PATCH] MM: reclaim mustn't enter FS for swap-over-NFS
Patch-mainline: Not yet - undergoing review
References: bsc#1191876
If swap-out is using filesystem operations (SWP_FS_OPS), then it is not
safe to enter the FS for reclaim.
So only down-grade the requirement for swap pages to __GFP_IO after
checking that SWP_FS_OPS are not being used.
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: NeilBrown <neilb@suse.com>
Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
---
mm/vmscan.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1439,7 +1439,11 @@ static unsigned int shrink_page_list(str
goto keep_locked;
may_enter_fs = (sc->gfp_mask & __GFP_FS) ||
- (PageSwapCache(page) && (sc->gfp_mask & __GFP_IO));
+ (PageSwapCache(page) &&
+#ifdef CONFIG_SWAP
+ !(page_swap_info(page)->flags & SWP_FS_OPS) &&
+#endif
+ (sc->gfp_mask & __GFP_IO));
/*
* The number of dirty pages determines if a node is marked
@@ -1596,7 +1600,12 @@ static unsigned int shrink_page_list(str
goto activate_locked_split;
}
- may_enter_fs = true;
+ if ((sc->gfp_mask & __GFP_FS)
+#ifdef CONFIG_SWAP
+ || !(page_swap_info(page)->flags & SWP_FS_OPS)
+#endif
+ )
+ may_enter_fs = true;
/* Adding to swap updated mapping */
mapping = page_mapping(page);