On Fri, Feb 27, 2026 at 04:00:26PM +0000, Dmitry Ilvokhin wrote:
> This intentionally breaks direct users of zone->lock at compile time so
> all call sites are converted to the zone lock wrappers. Without the
> rename, present and future out-of-tree code could continue using
> spin_lock(&zone->lock) and bypass the wrappers and tracing
> infrastructure.
> 
> No functional change intended.
> 
> Suggested-by: Andrew Morton <[email protected]>
> Signed-off-by: Dmitry Ilvokhin <[email protected]>
> Acked-by: Shakeel Butt <[email protected]>
> Acked-by: SeongJae Park <[email protected]>
> ---
>  include/linux/mmzone.h      |  7 +++++--
>  include/linux/mmzone_lock.h | 12 ++++++------
>  mm/compaction.c             |  4 ++--
>  mm/internal.h               |  2 +-
>  mm/page_alloc.c             | 16 ++++++++--------
>  mm/page_isolation.c         |  4 ++--
>  mm/page_owner.c             |  2 +-
>  7 files changed, 25 insertions(+), 22 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 3e51190a55e4..32bca655fce5 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -1009,8 +1009,11 @@ struct zone {
>       /* zone flags, see below */
>       unsigned long           flags;
>  
> -     /* Primarily protects free_area */
> -     spinlock_t              lock;
> +     /*
> +      * Primarily protects free_area. Should be accessed via zone_lock_*
> +      * helpers.
> +      */
> +     spinlock_t              _lock;

I really don't like this uglification.
Suggestion:
        spinlock_t __private    lock;

>  
>       /* Pages to be freed when next trylock succeeds */
>       struct llist_head       trylock_free_pages;
> diff --git a/include/linux/mmzone_lock.h b/include/linux/mmzone_lock.h
> index a1cfba8408d6..62e34d500078 100644
> --- a/include/linux/mmzone_lock.h
> +++ b/include/linux/mmzone_lock.h
> @@ -7,32 +7,32 @@
>  
>  static inline void zone_lock_init(struct zone *zone)
>  {
> -     spin_lock_init(&zone->lock);

and then ACCESS_PRIVATE() all over these helpers. This will not make a
difference to the compiler, but it will work with sparse.

It's not that I don't understand what you're doing, but we're going to need
to look to this code and refer to this code 20 years from now, I would rather
not refer to zone->_lock :)

-- 
Pedro

Reply via email to