From: "Nanzhe Zhao" <nzzhao@126.com>
To: "Barry Song" <21cnbao@gmail.com>
Cc: "Jaegeuk Kim" <jaegeuk@kernel.org>, "Chao Yu" <chao@kernel.org>,
linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re:Re: [PATCH v1 1/5] f2fs: Zero f2fs_folio_state on allocation
Date: Wed, 7 Jan 2026 11:44:35 +0800 (CST) [thread overview]
Message-ID: <1a779a14.3453.19b968e6f2d.Coremail.nzzhao@126.com> (raw)
In-Reply-To: <CAGsJ_4yrspqjbEK8vj8Fd9FCDAasQ7mp5nBsE0Zg9XX265PXgA@mail.gmail.com>
Hi Barry:
>At 2026-01-06 11:38:49, "Barry Song" <21cnbao@gmail.com> wrote:
>>On Tue, Jan 6, 2026 at 12:12 AM Nanzhe Zhao <nzzhao@126.com> wrote:
>>>
>>> f2fs_folio_state is attached to folio->private and is expected to start
>>> with read_pages_pending == 0. However, the structure was allocated from
>>> ffs_entry_slab without being fully initialized, which can leave
>>> read_pages_pending with stale values.
>>>
>>> Allocate the object with __GFP_ZERO so all fields are reliably zeroed at
>>> creation time.
>>>
>>> Signed-off-by: Nanzhe Zhao <nzzhao@126.com>
>>
>>
>>We already have GFP_F2FS_ZERO, but it includes GFP_IO. Should we
>>introduce another variant, such as GFP_F2FS_NOIO_ZERO (or similar)?
>>Overall, LGTM.
>>
I'm still not fully understand about the exact semantics of GFP_NOIO vs GFP_NOFS.
I did a bit of digging and, in the current buffered read / readahead context, it seems
like there may be no meaningful difference for the purpose of avoiding direct-reclaim
recursion deadlocks?
My current (possibly incomplete) understanding is that in may_enter_fs(), GFP_NOIO
only changes behavior for swapcache folios, rather than file-backed folios that are
currently in the read IO path,and the swap writeback path won't recurse back into f2fs's
own writeback function anyway. (On phones there usually isn't a swap partition; for zram
I guess swap writeback is effectively writing to RAM via the zram block device ?
Sorry for not being very familiar with the details there.)
I noticed iomap's ifs_alloc uses GFP_NOFS | __GFP_NOFAIL. So if GFP_NOFS is acceptable here,
we could simply use GFP_F2FS_ZERO and avoid introducing a new GFP_F2FS_NOIO_ZERO variant?
Just curious.I will vote for GFP_NOIO from semantic clarity perspective here.
Thanks,
Nanzhe
next prev parent reply other threads:[~2026-01-07 3:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 15:30 [PATCH v1 0/5] f2fs: fix large folio read corner cases for immutable files Nanzhe Zhao
2026-01-05 15:30 ` [PATCH v1 1/5] f2fs: Zero f2fs_folio_state on allocation Nanzhe Zhao
2026-01-06 3:38 ` Barry Song
2026-01-07 3:44 ` Nanzhe Zhao [this message]
2026-01-08 22:35 ` Barry Song
2026-01-06 9:16 ` Chao Yu
2026-01-05 15:30 ` [PATCH v1 2/5] f2fs: Accounting large folio subpages before bio submission Nanzhe Zhao
2026-01-06 9:16 ` Chao Yu
2026-01-05 15:30 ` [PATCH v1 3/5] f2fs: add f2fs_block_needs_zeroing() to handle hole blocks Nanzhe Zhao
2026-01-06 9:19 ` Chao Yu
2026-01-06 11:25 ` Nanzhe Zhao
2026-01-06 9:30 ` kernel test robot
2026-01-05 15:31 ` [PATCH v1 4/5] f2fs: add 'folio_in_bio' to handle readahead folios with no BIO submission Nanzhe Zhao
2026-01-06 9:31 ` Chao Yu
2026-01-07 0:33 ` Nanzhe Zhao
2026-01-07 1:16 ` Chao Yu
2026-01-05 15:31 ` [PATCH v1 5/5] f2fs: advance index and offset after zeroing in large folio read Nanzhe Zhao
2026-01-06 9:35 ` Chao Yu
2026-01-07 3:08 ` [PATCH v1 0/5] f2fs: fix large folio read corner cases for immutable files Jaegeuk Kim
2026-01-08 2:17 ` Nanzhe Zhao
2026-01-08 9:23 ` Chao Yu
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=1a779a14.3453.19b968e6f2d.Coremail.nzzhao@126.com \
--to=nzzhao@126.com \
--cc=21cnbao@gmail.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®