[PATCH v3 0/7] Modify memfd_luo code

Chenghao Duan
2026-03-26T08:47:55Z

I found several modifiable points while reading the code. Please review.

v3:
v2 patches remain unchanged, and v3 adds 3 additional patches.
<mm/memfd_luo: fix physical address conversion in put_folios cleanup>
<mm/memfd_luo: remove folio from page cache when accounting fails>
<mm/memfd_luo: fix integer overflow in memfd_luo_preserve_folios>

These three patches address issues identified by the AI review,
with the review link as follows:
https://sashiko.dev/#/patchset/20260323110747.193569-1-duanchenghao@kylinos.cn

v2:
https://lore.kernel.org/all/20260323140938.ba8943a5247c14b17bc70142@linux-foundation.org/

As suggested by Pratyush Yadav, add patch
<mm/memfd: use folio_nr_pages() for shmem inode accounting>.
https://lore.kernel.org/all/2vxzqzpebzi2.fsf@kernel.org/

<mm/memfd_luo: optimize shmem_recalc_inode calls in retrieve path>
Same as V1, no logic changes; depends on patch #1 for modifications.

<mm/memfd_luo: remove unnecessary memset in zero-size memfd path>
No modifications have been made.

<mm/memfd_luo: use i_size_write() to set inode size during retrieve>
Add consistency-related descriptions to the commit log.

v1:
https://lore.kernel.org/all/20260319012845.29570-1-duanchenghao@kylinos.cn/

Chenghao Duan (7):
mm/memfd: use folio_nr_pages() for shmem inode accounting
mm/memfd_luo: optimize shmem_recalc_inode calls in retrieve path
mm/memfd_luo: remove unnecessary memset in zero-size memfd path
mm/memfd_luo: use i_size_write() to set inode size during retrieve
mm/memfd_luo: fix physical address conversion in put_folios cleanup
mm/memfd_luo: remove folio from page cache when accounting fails
mm/memfd_luo: fix integer overflow in memfd_luo_preserve_folios

mm/memfd_luo.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)

--
2.25.1