Re: [PATCH v5 09/12] mm: constify ptdesc_pmd_pts_count() and folio_get_private()
From: Lorenzo Stoakes
Date: Mon Sep 01 2025 - 10:53:03 EST
On Mon, Sep 01, 2025 at 02:30:25PM +0200, Max Kellermann wrote:
> These functions from mm_types.h are trivial getters that should never
> write to the given pointers.
>
> Signed-off-by: Max Kellermann <max.kellermann@xxxxxxxxx>
> Reviewed-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx>
(Again, on basis of us figuring out whether we want the double-const)
LGTM, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> ---
> include/linux/mm_types.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index d934a3a5b443..46e27ee14bcf 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -632,7 +632,7 @@ static inline void ptdesc_pmd_pts_dec(struct ptdesc *ptdesc)
> atomic_dec(&ptdesc->pt_share_count);
> }
>
> -static inline int ptdesc_pmd_pts_count(struct ptdesc *ptdesc)
> +static inline int ptdesc_pmd_pts_count(const struct ptdesc *const ptdesc)
> {
> return atomic_read(&ptdesc->pt_share_count);
> }
> @@ -660,7 +660,7 @@ static inline void set_page_private(struct page *page, unsigned long private)
> page->private = private;
> }
>
> -static inline void *folio_get_private(struct folio *folio)
> +static inline void *folio_get_private(const struct folio *const folio)
> {
> return folio->private;
> }
> --
> 2.47.2
>