From patchwork Sun Feb 2 20:46:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 13956644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from pdx1-mailman-customer002.dreamhost.com (listserver-buz.dreamhost.com [69.163.136.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 166C4C0218F for ; Sun, 2 Feb 2025 20:49:20 +0000 (UTC) Received: from pdx1-mailman-customer002.dreamhost.com (localhost [127.0.0.1]) by pdx1-mailman-customer002.dreamhost.com (Postfix) with ESMTP id 4YmMBT2JPqz1y8m; Sun, 02 Feb 2025 12:47:13 -0800 (PST) Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by pdx1-mailman-customer002.dreamhost.com (Postfix) with ESMTPS id 4YmM9v3zdLz1wfJ for ; Sun, 02 Feb 2025 12:46:43 -0800 (PST) Received: from star2.ccs.ornl.gov (ltm-e204-208.ccs.ornl.gov [160.91.203.12]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id ACAD2893D84; Sun, 2 Feb 2025 15:46:41 -0500 (EST) Received: by star2.ccs.ornl.gov (Postfix, from userid 2004) id A5116106BE19; Sun, 2 Feb 2025 15:46:41 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Sun, 2 Feb 2025 15:46:04 -0500 Message-ID: <20250202204633.1148872-5-jsimmons@infradead.org> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250202204633.1148872-1-jsimmons@infradead.org> References: <20250202204633.1148872-1-jsimmons@infradead.org> MIME-Version: 1.0 Subject: [lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Qian Yingjin 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 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50625 Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- 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";