All of lore.kernel.org
 help / color / mirror / Atom feed
* mm/page_alloc.c:3472 reserve_highatomic_pageblock() warn: inconsistent returns '&zone->lock'.
@ 2026-10-09  6:19 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-10-09  6:19 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Dmitry Ilvokhin <d@ilvokhin.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   af32da41b0327b9c6a37856ba82b6760d6c8d10e
commit: 5ebb2064da361ca860c052bca9ae37962adef3f7 mm: use zone lock guard in reserve_highatomic_pageblock()
date:   4 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 4 months ago
config: loongarch-randconfig-r2200-20261009 (https://download.01.org/0day-ci/archive/20261009/202610090809.1WrAzuGx-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 16.1.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 5ebb2064da36 ("mm: use zone lock guard in reserve_highatomic_pageblock()")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610090809.1WrAzuGx-lkp@intel.com/

smatch warnings:
mm/page_alloc.c:3472 reserve_highatomic_pageblock() warn: inconsistent returns '&zone->lock'.
mm/page_alloc.c:3472 reserve_highatomic_pageblock() warn: inconsistent returns 'irq'.

vim +3472 mm/page_alloc.c

^1da177e4c3f415 Linus Torvalds  2005-04-16  3435  
a4138a2702a4428 Johannes Weiner 2025-02-24  3436  /*
a4138a2702a4428 Johannes Weiner 2025-02-24  3437   * Reserve the pageblock(s) surrounding an allocation request for
a4138a2702a4428 Johannes Weiner 2025-02-24  3438   * exclusive use of high-order atomic allocations if there are no
a4138a2702a4428 Johannes Weiner 2025-02-24  3439   * empty page blocks that contain a page with a suitable order
a4138a2702a4428 Johannes Weiner 2025-02-24  3440   */
a4138a2702a4428 Johannes Weiner 2025-02-24  3441  static void reserve_highatomic_pageblock(struct page *page, int order,
a4138a2702a4428 Johannes Weiner 2025-02-24  3442  					 struct zone *zone)
a4138a2702a4428 Johannes Weiner 2025-02-24  3443  {
a4138a2702a4428 Johannes Weiner 2025-02-24  3444  	int mt;
5ebb2064da361ca Dmitry Ilvokhin 2026-04-29  3445  	unsigned long max_managed;
a4138a2702a4428 Johannes Weiner 2025-02-24  3446  
a4138a2702a4428 Johannes Weiner 2025-02-24  3447  	/*
a4138a2702a4428 Johannes Weiner 2025-02-24  3448  	 * The number reserved as: minimum is 1 pageblock, maximum is
a4138a2702a4428 Johannes Weiner 2025-02-24  3449  	 * roughly 1% of a zone. But if 1% of a zone falls below a
a4138a2702a4428 Johannes Weiner 2025-02-24  3450  	 * pageblock size, then don't reserve any pageblocks.
a4138a2702a4428 Johannes Weiner 2025-02-24  3451  	 * Check is race-prone but harmless.
a4138a2702a4428 Johannes Weiner 2025-02-24  3452  	 */
a4138a2702a4428 Johannes Weiner 2025-02-24  3453  	if ((zone_managed_pages(zone) / 100) < pageblock_nr_pages)
a4138a2702a4428 Johannes Weiner 2025-02-24  3454  		return;
a4138a2702a4428 Johannes Weiner 2025-02-24  3455  	max_managed = ALIGN((zone_managed_pages(zone) / 100), pageblock_nr_pages);
a4138a2702a4428 Johannes Weiner 2025-02-24  3456  	if (zone->nr_reserved_highatomic >= max_managed)
a4138a2702a4428 Johannes Weiner 2025-02-24  3457  		return;
a4138a2702a4428 Johannes Weiner 2025-02-24  3458  
5ebb2064da361ca Dmitry Ilvokhin 2026-04-29  3459  	guard(spinlock_irqsave)(&zone->lock);
a4138a2702a4428 Johannes Weiner 2025-02-24  3460  
a4138a2702a4428 Johannes Weiner 2025-02-24  3461  	/* Recheck the nr_reserved_highatomic limit under the lock */
a4138a2702a4428 Johannes Weiner 2025-02-24  3462  	if (zone->nr_reserved_highatomic >= max_managed)
5ebb2064da361ca Dmitry Ilvokhin 2026-04-29  3463  		return;
a4138a2702a4428 Johannes Weiner 2025-02-24  3464  
a4138a2702a4428 Johannes Weiner 2025-02-24  3465  	/* Yoink! */
a4138a2702a4428 Johannes Weiner 2025-02-24  3466  	mt = get_pageblock_migratetype(page);
a4138a2702a4428 Johannes Weiner 2025-02-24  3467  	/* Only reserve normal pageblocks (i.e., they can merge with others) */
a4138a2702a4428 Johannes Weiner 2025-02-24  3468  	if (!migratetype_is_mergeable(mt))
5ebb2064da361ca Dmitry Ilvokhin 2026-04-29  3469  		return;
a4138a2702a4428 Johannes Weiner 2025-02-24  3470  
a4138a2702a4428 Johannes Weiner 2025-02-24  3471  	if (order < pageblock_order) {
a4138a2702a4428 Johannes Weiner 2025-02-24 @3472  		if (move_freepages_block(zone, page, mt, MIGRATE_HIGHATOMIC) == -1)
5ebb2064da361ca Dmitry Ilvokhin 2026-04-29  3473  			return;
a4138a2702a4428 Johannes Weiner 2025-02-24  3474  		zone->nr_reserved_highatomic += pageblock_nr_pages;
a4138a2702a4428 Johannes Weiner 2025-02-24  3475  	} else {
a4138a2702a4428 Johannes Weiner 2025-02-24  3476  		change_pageblock_range(page, order, MIGRATE_HIGHATOMIC);
a4138a2702a4428 Johannes Weiner 2025-02-24  3477  		zone->nr_reserved_highatomic += 1 << order;
a4138a2702a4428 Johannes Weiner 2025-02-24  3478  	}
a4138a2702a4428 Johannes Weiner 2025-02-24  3479  }
a4138a2702a4428 Johannes Weiner 2025-02-24  3480  

:::::: The code at line 3472 was first introduced by commit
:::::: a4138a2702a4428317ecdb115934554df4b788b4 mm: page_alloc: group fallback functions together

:::::: TO: Johannes Weiner <hannes@cmpxchg.org>
:::::: CC: Andrew Morton <akpm@linux-foundation.org>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-09  6:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  6:19 mm/page_alloc.c:3472 reserve_highatomic_pageblock() warn: inconsistent returns '&zone->lock' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.