Re: [PATCH v5 10/12] mm: constify various inline test functions for improved const-correctness

From: David Hildenbrand
Date: Mon Sep 01 2025 - 10:01:39 EST


On 01.09.25 14:30, Max Kellermann wrote:
We select certain test functions from mm_inline.h which either invoke
each other, functions that are already const-ified, or no further
functions.

It is therefore relatively trivial to const-ify them, which
provides a basis for further const-ification further up the call
stack.

One exception is the function folio_migrate_refs() which does write to
the "new" folio pointer; there, only the "old" folio pointer is being
constified; only its "flags" field is read, but nothing written.

Signed-off-by: Max Kellermann <max.kellermann@xxxxxxxxx>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx>
---

Also some getters hiding (and functions that actually implement logic -- folio_migrate_refs())

[...]

-static inline int folio_lru_gen(struct folio *folio)
+static inline int folio_lru_gen(const struct folio *folio)

*const ?

--
Cheers

David / dhildenb