On 9/8/26 04:56, Zi Yan wrote:
> folio_test_fs_private() wraps folio->private != NULL check and excludes
> swapcache and hugetlb folios, since swapcache uses swp_entry_t overlapping
> with folio->private and hugetlb sets its own flags in folio->private.
> Replace open code with the helper, since core MM does this check
> frequently.
> 
> No functional change intended.
> 
> Assisted-by: Claude:claude-opus-4-8
> Assisted-by: Codex:gpt-5
> Signed-off-by: Zi Yan <[email protected]>
> To: Andrew Morton <[email protected]>
> To: David Hildenbrand <[email protected]>
> To: Steven Rostedt <[email protected]>
> To: Masami Hiramatsu <[email protected]>
> To: Lorenzo Stoakes <[email protected]>
> Cc: "Liam R. Howlett" <[email protected]>
> Cc: Vlastimil Babka <[email protected]>
> Cc: Mike Rapoport <[email protected]>
> Cc: Suren Baghdasaryan <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Mathieu Desnoyers <[email protected]>
> Cc: Zi Yan <[email protected]>
> Cc: Baolin Wang <[email protected]>
> Cc: Nico Pache <[email protected]>
> Cc: Ryan Roberts <[email protected]>
> Cc: Dev Jain <[email protected]>
> Cc: Barry Song <[email protected]>
> Cc: Lance Yang <[email protected]>
> Cc: Usama Arif <[email protected]>
> Cc: Matthew Brost <[email protected]>
> Cc: Joshua Hahn <[email protected]>
> Cc: Rakie Kim <[email protected]>
> Cc: Byungchul Park <[email protected]>
> Cc: Gregory Price <[email protected]>
> Cc: Ying Huang <[email protected]>
> Cc: Alistair Popple <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
>  include/linux/mm.h             |  4 +---
>  include/linux/page-flags.h     | 26 +++++++++++++++++++++++---
>  include/trace/events/pagemap.h |  4 +---
>  mm/huge_memory.c               |  4 +---
>  mm/migrate.c                   |  3 +--
>  mm/page-writeback.c            |  5 +----
>  mm/vmscan.c                    |  3 +--
>  7 files changed, 29 insertions(+), 20 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 5eb8a62fafb56..c861525cda83f 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3053,9 +3053,7 @@ static inline int folio_expected_ref_count(const struct 
> folio *folio)
>                * One reference from filesystem private data.
>                * Use data_race() since folio might not be locked.
>                */
> -             ref_count += data_race(folio_test_private(folio)) &&
> -                          !folio_test_hugetlb(folio) &&
> -                          !folio_test_swapbacked(folio);
> +             ref_count += data_race(folio_test_fs_private(folio));
>       }

Lol :) That's what I meant with folio_has_attached_private()

(I think I prefer that name as it matches folio_attach_private(), but I might be
biased ;) )


This really should be sqashed into the previous patch, OR, have a prep patch
that only replaces these instances and uses folio_test_private() until you
convert it to folio->private in the second patch.

In short: touch these call sites only once, not twice in a row.

-- 
Cheers,

David

Reply via email to