From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1123229B18 for ; Thu, 26 Feb 2026 21:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772141156; cv=none; b=boXYwr9FBauw0wxL/wGrCYC579fULuAYh4oTY9b8pu7/KEOdyXtVYxRlzVocXoGRBYda7ZQqvIJuxI1XEfI0EsoW2V0kgA/Y2WaCjA7sGF3C/+fePmjNlNfVJFDy0Lid78aTOanVp1mNdCXz95FR078mKWJFVfXiHfNMCIOkiwM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772141156; c=relaxed/simple; bh=irZ2fE6lcQL0ElIWMx5KYqPqy3ehuPvVJkpkO803Fk0=; h=Date:To:From:Subject:Message-Id; b=gYLqIo0Xq2lYSEcJojLJhAhAOvXIgQjHiA/gS0sZQUFsDDtVRdwVPDbzHv9xFu1P7Gr7atvwIr+5U8kZFce70g8K4nXmMcZdCSsX4EZWNC99ZJAIEskQJYYORnqmJNJox28e5sm68Ix7jVZTny7iCy3hKX7GhV2ButYByEilkjM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=fnTaJ/xO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="fnTaJ/xO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FD23C116C6; Thu, 26 Feb 2026 21:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1772141156; bh=irZ2fE6lcQL0ElIWMx5KYqPqy3ehuPvVJkpkO803Fk0=; h=Date:To:From:Subject:From; b=fnTaJ/xOwff7bOApOr8PEhRFwR3FMbeg8eU9Ii24vr5Qe1pGqO3gTxUv3EYlbi6d7 LAgfAPaLOuq29VTDFbeCvvTARkRNXqzp+r0CRPKhMYb2H3j4XuNO1trN7VRbX+c9ds gmkHnYwbTUqnIxJvIy/iMvE2Oe88ihdlkmvGUBtA= Date: Thu, 26 Feb 2026 13:25:55 -0800 To: mm-commits@vger.kernel.org,ziy@nvidia.com,zhengqi.arch@bytedance.com,yuanchu@google.com,weixugc@google.com,vbabka@suse.cz,surenb@google.com,shakeel.butt@linux.dev,rppt@kernel.org,rostedt@goodmis.org,osalvador@suse.de,mhocko@suse.com,mhiramat@kernel.org,mathieu.desnoyers@efficios.com,lorenzo.stoakes@oracle.com,liam.howlett@oracle.com,jackmanb@google.com,hannes@cmpxchg.org,david@kernel.org,benjamin.cheatham@amd.com,axelrasmussen@google.com,akpm@linux-foundation.org,d@ilvokhin.com,akpm@linux-foundation.org From: Andrew Morton Subject: + mm-rename-zone-lock-to-zone-_lock.patch added to mm-new branch Message-Id: <20260226212556.7FD23C116C6@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: mm: rename zone->lock to zone->_lock has been added to the -mm mm-new branch. Its filename is mm-rename-zone-lock-to-zone-_lock.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-rename-zone-lock-to-zone-_lock.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Dmitry Ilvokhin Subject: mm: rename zone->lock to zone->_lock Date: Thu, 26 Feb 2026 18:26:21 +0000 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. Link: https://lkml.kernel.org/r/1221b8e7fa9f5694f3c4e411f01581b5aba9bc63.1772129168.git.d@ilvokhin.com Signed-off-by: Dmitry Ilvokhin Suggested-by: Andrew Morton Acked-by: Shakeel Butt Cc: Axel Rasmussen Cc: Ben Cheatham Cc: Brendan Jackman Cc: David Hildenbrand Cc: Johannes Weiner Cc: Liam Howlett Cc: Lorenzo Stoakes Cc: "Masami Hiramatsu (Google)" Cc: Mathieu Desnoyers Cc: Michal Hocko Cc: Mike Rapoport Cc: Oscar Salvador Cc: Qi Zheng Cc: Steven Rostedt Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Wei Xu Cc: Yuanchu Xie Cc: Zi Yan Signed-off-by: Andrew Morton --- include/linux/mmzone.h | 7 +++++-- include/linux/zone_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(-) --- a/include/linux/mmzone.h~mm-rename-zone-lock-to-zone-_lock +++ a/include/linux/mmzone.h @@ -1040,8 +1040,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; /* Pages to be freed when next trylock succeeds */ struct llist_head trylock_free_pages; --- a/include/linux/zone_lock.h~mm-rename-zone-lock-to-zone-_lock +++ a/include/linux/zone_lock.h @@ -7,32 +7,32 @@ static inline void zone_lock_init(struct zone *zone) { - spin_lock_init(&zone->lock); + spin_lock_init(&zone->_lock); } #define zone_lock_irqsave(zone, flags) \ do { \ - spin_lock_irqsave(&(zone)->lock, flags); \ + spin_lock_irqsave(&(zone)->_lock, flags); \ } while (0) #define zone_trylock_irqsave(zone, flags) \ ({ \ - spin_trylock_irqsave(&(zone)->lock, flags); \ + spin_trylock_irqsave(&(zone)->_lock, flags); \ }) static inline void zone_unlock_irqrestore(struct zone *zone, unsigned long flags) { - spin_unlock_irqrestore(&zone->lock, flags); + spin_unlock_irqrestore(&zone->_lock, flags); } static inline void zone_lock_irq(struct zone *zone) { - spin_lock_irq(&zone->lock); + spin_lock_irq(&zone->_lock); } static inline void zone_unlock_irq(struct zone *zone) { - spin_unlock_irq(&zone->lock); + spin_unlock_irq(&zone->_lock); } #endif /* _LINUX_ZONE_LOCK_H */ --- a/mm/compaction.c~mm-rename-zone-lock-to-zone-_lock +++ a/mm/compaction.c @@ -506,7 +506,7 @@ static bool test_and_set_skip(struct com static bool compact_zone_lock_irqsave(struct zone *zone, unsigned long *flags, struct compact_control *cc) -__acquires(&zone->lock) +__acquires(&zone->_lock) { /* Track if the lock is contended in async mode */ if (cc->mode == MIGRATE_ASYNC && !cc->contended) { @@ -1419,7 +1419,7 @@ static bool suitable_migration_target(st int order = cc->order > 0 ? cc->order : pageblock_order; /* - * We are checking page_order without zone->lock taken. But + * We are checking page_order without zone->_lock taken. But * the only small danger is that we skip a potentially suitable * pageblock, so it's not worth to check order for valid range. */ --- a/mm/internal.h~mm-rename-zone-lock-to-zone-_lock +++ a/mm/internal.h @@ -729,7 +729,7 @@ static inline unsigned int buddy_order(s * (d) a page and its buddy are in the same zone. * * For recording whether a page is in the buddy system, we set PageBuddy. - * Setting, clearing, and testing PageBuddy is serialized by zone->lock. + * Setting, clearing, and testing PageBuddy is serialized by zone->_lock. * * For recording page's order, we use page_private(page). */ --- a/mm/page_alloc.c~mm-rename-zone-lock-to-zone-_lock +++ a/mm/page_alloc.c @@ -815,7 +815,7 @@ compaction_capture(struct capture_contro static inline void account_freepages(struct zone *zone, int nr_pages, int migratetype) { - lockdep_assert_held(&zone->lock); + lockdep_assert_held(&zone->_lock); if (is_migrate_isolate(migratetype)) return; @@ -2476,7 +2476,7 @@ enum rmqueue_mode { /* * Do the hard work of removing an element from the buddy allocator. - * Call me with the zone->lock already held. + * Call me with the zone->_lock already held. */ static __always_inline struct page * __rmqueue(struct zone *zone, unsigned int order, int migratetype, @@ -2504,7 +2504,7 @@ __rmqueue(struct zone *zone, unsigned in * fallbacks modes with increasing levels of fragmentation risk. * * The fallback logic is expensive and rmqueue_bulk() calls in - * a loop with the zone->lock held, meaning the freelists are + * a loop with the zone->_lock held, meaning the freelists are * not subject to any outside changes. Remember in *mode where * we found pay dirt, to save us the search on the next call. */ @@ -3206,7 +3206,7 @@ void __putback_isolated_page(struct page struct zone *zone = page_zone(page); /* zone lock should be held when this function is called */ - lockdep_assert_held(&zone->lock); + lockdep_assert_held(&zone->_lock); /* Return isolated page to tail of freelist. */ __free_one_page(page, page_to_pfn(page), zone, order, mt, @@ -7090,7 +7090,7 @@ int alloc_contig_frozen_range_noprof(uns * pages. Because of this, we reserve the bigger range and * once this is done free the pages we are not interested in. * - * We don't have to hold zone->lock here because the pages are + * We don't have to hold zone->_lock here because the pages are * isolated thus they won't get removed from buddy. */ outer_start = find_large_buddy(start); @@ -7659,7 +7659,7 @@ void accept_page(struct page *page) return; } - /* Unlocks zone->lock */ + /* Unlocks zone->_lock */ __accept_page(zone, &flags, page); } @@ -7676,7 +7676,7 @@ static bool try_to_accept_memory_one(str return false; } - /* Unlocks zone->lock */ + /* Unlocks zone->_lock */ __accept_page(zone, &flags, page); return true; @@ -7817,7 +7817,7 @@ struct page *alloc_frozen_pages_nolock_n /* * Best effort allocation from percpu free list. - * If it's empty attempt to spin_trylock zone->lock. + * If it's empty attempt to spin_trylock zone->_lock. */ page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac); --- a/mm/page_isolation.c~mm-rename-zone-lock-to-zone-_lock +++ a/mm/page_isolation.c @@ -212,7 +212,7 @@ static int set_migratetype_isolate(struc zone_unlock_irqrestore(zone, flags); if (mode == PB_ISOLATE_MODE_MEM_OFFLINE) { /* - * printk() with zone->lock held will likely trigger a + * printk() with zone->_lock held will likely trigger a * lockdep splat, so defer it here. */ dump_page(unmovable, "unmovable page"); @@ -553,7 +553,7 @@ void undo_isolate_page_range(unsigned lo /* * Test all pages in the range is free(means isolated) or not. * all pages in [start_pfn...end_pfn) must be in the same zone. - * zone->lock must be held before call this. + * zone->_lock must be held before call this. * * Returns the last tested pfn. */ --- a/mm/page_owner.c~mm-rename-zone-lock-to-zone-_lock +++ a/mm/page_owner.c @@ -799,7 +799,7 @@ static void init_pages_in_zone(struct zo continue; /* - * To avoid having to grab zone->lock, be a little + * To avoid having to grab zone->_lock, be a little * careful when reading buddy page order. The only * danger is that we skip too much and potentially miss * some early allocated pages, which is better than _ Patches currently in -mm which might be from d@ilvokhin.com are mm-introduce-zone-lock-wrappers.patch mm-convert-zone-lock-users-to-wrappers.patch mm-convert-compaction-to-zone-lock-wrappers.patch mm-rename-zone-lock-to-zone-_lock.patch mm-add-tracepoints-for-zone-lock.patch