mm: use folio_expected_ref_count() helper for reference counting
Subsystems (5)
PATCH v2 1/1 mm: use folio_expected_ref_count() helper for reference counting
Replace open-coded folio reference count calculations with the folio_expected_ref_count().
No functional changes intended.
Signed-off-by Shivank Garg <[email protected]>
---
Changes from V1:
- https://lore.kernel.org/linux-mm/[email protected]
- remove extra comments
- drop RFC tag
--- kernel/events/uprobes.c | 3 +-- mm/memfd.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
kernel/events/uprobes.c +1 -2
@@ -436,8 +436,7 @@ static int __uprobe_write_opcode(struct vm_area_struct *vma,* there are no unexpected folio references ... */ if (is_register ||userfaultfd_missing (vma) || - (folio_ref_count (folio) !=folio_mapcount (folio) +1 + -folio_test_swapcache (folio) *folio_nr_pages (folio))) + (folio_ref_count (folio) !=folio_expected_ref_count (folio) +1 )) goto remap;/*
mm/memfd.c +1 -2
@@ -32,8 +32,7 @@static bool memfd_folio_has_extra_refs (struct folio *folio) { -return folio_ref_count (folio) -folio_mapcount (folio) != -folio_nr_pages (folio); +return folio_ref_count (folio) !=folio_expected_ref_count (folio); }static void memfd_tag_pins (struct xa_state *xas)
Signature · 1 line
2.43.0
Quoted 7 lines · Shivank Garg
Replace open-coded folio reference count calculations with the
folio_expected_ref_count().No functional changes intended.
Signed-off-by Shivank Garg <[email protected]>
Reviewed-by Oscar Salvador <[email protected]>
Signature · 2 lines
Oscar Salvador SUSE Labs