From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: jiucheng.xu@amlogic.com, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: tuan.zhang@amlogic.com, linux-kernel@vger.kernel.org,
jianxin.pan@amlogic.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: Use mapping->gfp_mask to get file cache for writing
Date: Wed, 24 Sep 2025 10:25:14 +0800 [thread overview]
Message-ID: <d6609f12-78c2-4a42-b4fd-689b310ec615@kernel.org> (raw)
In-Reply-To: <20250918-origin-dev-v1-1-8d9877df9e77@amlogic.com>
On 9/18/25 11:32, Jiucheng Xu via B4 Relay wrote:
> From: Jiucheng Xu <jiucheng.xu@amlogic.com>
>
> On 32-bit architectures, when GFP_NOFS is used, the file cache for write
> operations cannot be allocated from the highmem and CMA.
Hi,
Have you suffered any problem w/o this patch? Can you please describe more
details about it?
>
> Since mapping->gfp_mask is set to GFP_HIGHUSER_MOVABLE during inode
GFP_HIGHUSER_MOVABLE includes __GFP_FS, we should avoid using __GFP_FS here.
f2fs_write_begin() uses GFP_NOFS like the most of other filesystem to avoid
potential deadlock, as __filemap_get_folio(, .. |__GFP_FS | ..) may run into
memory reclaim to call ->writeback in where we may suffer deadlock potentially.
Thanks,
> allocation, using mapping_gfp_mask(mapping) as the GFP flag of getting file
> cache for writing is more efficient for 32-bit architectures.
> > Signed-off-by: Jiucheng Xu <jiucheng.xu@amlogic.com>
> ---
> fs/f2fs/data.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 7961e0ddfca3aaa332b7dbd4985ae7766551834f..9fbc41f9accb2626da22754f1a424da4805ca823 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3587,7 +3587,8 @@ static int f2fs_write_begin(const struct kiocb *iocb,
> * Will wait that below with our IO control.
> */
> folio = __filemap_get_folio(mapping, index,
> - FGP_LOCK | FGP_WRITE | FGP_CREAT, GFP_NOFS);
> + FGP_LOCK | FGP_WRITE | FGP_CREAT,
> + mapping_gfp_mask(mapping));
> if (IS_ERR(folio)) {
> err = PTR_ERR(folio);
> goto fail;
>
> ---
> base-commit: c872b6279cd26762339ff02513e2a3f16149a6f1
> change-id: 20250910-origin-dev-8a5ff6bee1f2
>
> Best regards,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2025-09-24 2:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 3:32 [f2fs-dev] [PATCH] f2fs: Use mapping->gfp_mask to get file cache for writing Jiucheng Xu via B4 Relay via Linux-f2fs-devel
2025-09-24 2:25 ` Chao Yu via Linux-f2fs-devel [this message]
2025-09-30 3:17 ` Jiucheng Xu via Linux-f2fs-devel
2025-10-09 2:25 ` Chao Yu via Linux-f2fs-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d6609f12-78c2-4a42-b4fd-689b310ec615@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=jianxin.pan@amlogic.com \
--cc=jiucheng.xu@amlogic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tuan.zhang@amlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).