Re: [RFC PATCH 1/2] mm: make ref_unless functions unless_zero only

From: David Hildenbrand (Arm)

Date: Fri Feb 06 2026 - 08:17:40 EST


On 12/19/25 13:46, Gladyshev Ilya wrote:
There are no users of (folio/page)_ref_add_unless(page, nr, u) with
u != 0 [1] and all current users are "internal" for page refcounting API.
This allows us to safely drop this parameter and reduce function
semantics to the "unless zero" cases only, which will be optimized in
the following patch.

If needed, these functions for the u!=0 cases can be trivially
reintroduced later using the same atomic_add_unless operations as before.

[1]: The last user was dropped in v5.18 kernel, commit 27674ef6c73f
("mm: remove the extra ZONE_DEVICE struct page refcount"). There is no
trace of discussion as to why this cleanup wasn't done earlier.

Co-developed-by: Gorbunov Ivan <gorbunov.ivan@xxxxxxxxxxxxxx>
Signed-off-by: Gorbunov Ivan <gorbunov.ivan@xxxxxxxxxxxxxx>
Signed-off-by: Gladyshev Ilya <gladyshev.ilya1@xxxxxxxxxxxxxx>
---

This one makes a lot of sense even without #2. Can you send that out early as a standalone patch?

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David