[lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page
James Simmons
jsimmons at infradead.org
Sun Feb 2 12:46:04 PST 2025
From: Qian Yingjin <qian at ddn.com>
We need __GFP_NORETRY for read-ahead page, otherwise the read
process would be OOM killed when reached cgroup memory limits.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16713
Lustre-commit: 8db5d39f669f03aa6 ("LU-16713 llite: add __GFP_NORETRY for read-ahead page")
Signed-off-by: Qian Yingjin <qian at ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50625
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/llite/rw.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c
index 92a9c252247e..9b1cf71116df 100644
--- a/fs/lustre/llite/rw.c
+++ b/fs/lustre/llite/rw.c
@@ -210,7 +210,16 @@ static int ll_read_ahead_page(const struct lu_env *env, struct cl_io *io,
switch (hint) {
case MAYNEED:
- vmpage = grab_cache_page_nowait(inode->i_mapping, index);
+ /*
+ * We need __GFP_NORETRY here for read-ahead page, otherwise
+ * the process will fail with OOM killed due to memcg limit.
+ * See @readahead_gfp_mask for an example.
+ */
+ vmpage = pagecache_get_page(inode->i_mapping, index,
+ FGP_LOCK | FGP_CREAT |
+ FGP_NOFS | FGP_NOWAIT,
+ mapping_gfp_mask(inode->i_mapping) |
+ __GFP_NORETRY | __GFP_NOWARN);
if (!vmpage) {
which = RA_STAT_FAILED_GRAB_PAGE;
msg = "g_c_p_n failed";
--
2.39.3
More information about the lustre-devel
mailing list