[PATCH 0/3] mm: introduce snapshot_page()

Luiz Capitulino posted 3 patches 3 months, 1 week ago
There is a newer version of this series
fs/proc/page.c     | 46 +++++++++++++++++++----------
include/linux/mm.h | 20 +++++++++++++
mm/debug.c         | 42 +++------------------------
mm/util.c          | 72 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 127 insertions(+), 53 deletions(-)
[PATCH 0/3] mm: introduce snapshot_page()
Posted by Luiz Capitulino 3 months, 1 week ago
Hi,

This series introduces snapshot_page(), a helper function that can be used
to create a snapshot of a struct page and its associated struct folio.

This function is intended to help callers with a consistent view of a
a folio while reducing the chance of encountering partially updated or
inconsistent state, such as during folio splitting which could lead to
crashes and BUG_ON()s being triggered.

This series is on top of latest Linus tree (c4dce0c094a8).

Changelog
=========

RFC -> v1
  - Include <linux/page_idle.h> to avoid build error on sh arch

Luiz Capitulino (3):
  mm: introduce snapshot_page()
  proc: kpagecount: use snapshot_page()
  fs: stable_page_flags(): use snapshot_page()

 fs/proc/page.c     | 46 +++++++++++++++++++----------
 include/linux/mm.h | 20 +++++++++++++
 mm/debug.c         | 42 +++------------------------
 mm/util.c          | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 127 insertions(+), 53 deletions(-)

-- 
2.49.0
Re: [PATCH 0/3] mm: introduce snapshot_page()
Posted by Shivank Garg 3 months, 1 week ago

On 6/26/2025 11:46 PM, Luiz Capitulino wrote:
> Hi,
> 
> This series introduces snapshot_page(), a helper function that can be used
> to create a snapshot of a struct page and its associated struct folio.
> 
> This function is intended to help callers with a consistent view of a
> a folio while reducing the chance of encountering partially updated or
> inconsistent state, such as during folio splitting which could lead to
> crashes and BUG_ON()s being triggered.

We could consider adding a Reported-by: tag and a link to the syzbot report.

I believe this is the relevant one:
https://lore.kernel.org/all/67812fbd.050a0220.d0267.0030.GAE@google.com
Re: [PATCH 0/3] mm: introduce snapshot_page()
Posted by Luiz Capitulino 3 months, 1 week ago
On 2025-07-02 02:40, Shivank Garg wrote:
> 
> 
> On 6/26/2025 11:46 PM, Luiz Capitulino wrote:
>> Hi,
>>
>> This series introduces snapshot_page(), a helper function that can be used
>> to create a snapshot of a struct page and its associated struct folio.
>>
>> This function is intended to help callers with a consistent view of a
>> a folio while reducing the chance of encountering partially updated or
>> inconsistent state, such as during folio splitting which could lead to
>> crashes and BUG_ON()s being triggered.
> 
> We could consider adding a Reported-by: tag and a link to the syzbot report.
> 
> I believe this is the relevant one:
> https://lore.kernel.org/all/67812fbd.050a0220.d0267.0030.GAE@google.com

I'll add it, thanks for the review.