All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:android14-6.1 1/1] mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t
@ 2025-06-14 15:18 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-06-14 15:18 UTC (permalink / raw)
  To: cros-kernel-buildreports; +Cc: oe-kbuild-all

tree:   https://android.googlesource.com/kernel/common android14-6.1
head:   6246d345f5505e8706cee3b1dfddc39f6079b4ea
commit: ff8496749db9c34c8a8c0056e4701e2c4a693bd7 [1/1] ANDROID: vendor_hooks: vendor hook for MM
config: x86_64-randconfig-r111-20250614 (https://download.01.org/0day-ci/archive/20250614/202506142357.4ZasuUtb-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250614/202506142357.4ZasuUtb-lkp@intel.com/reproduce)

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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506142357.4ZasuUtb-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t
>> mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t
>> mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t
>> mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t
   mm/page_alloc.c:3571:6: sparse: sparse: context imbalance in 'free_unref_page' - different lock contexts for basic block
   mm/page_alloc.c:3678:17: sparse: sparse: context imbalance in 'free_unref_page_list' - unexpected unlock
>> mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t
   mm/page_alloc.c:3869:20: sparse: sparse: context imbalance in 'rmqueue_pcplist' - different lock contexts for basic block
   mm/page_alloc.c:5610:9: sparse: sparse: context imbalance in '__alloc_pages_bulk' - different lock contexts for basic block
>> mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t

vim +1147 mm/page_alloc.c

  1109	
  1110	/*
  1111	 * Freeing function for a buddy system allocator.
  1112	 *
  1113	 * The concept of a buddy system is to maintain direct-mapped table
  1114	 * (containing bit values) for memory blocks of various "orders".
  1115	 * The bottom level table contains the map for the smallest allocatable
  1116	 * units of memory (here, pages), and each level above it describes
  1117	 * pairs of units from the levels below, hence, "buddies".
  1118	 * At a high level, all that happens here is marking the table entry
  1119	 * at the bottom level available, and propagating the changes upward
  1120	 * as necessary, plus some accounting needed to play nicely with other
  1121	 * parts of the VM system.
  1122	 * At each level, we keep a list of pages, which are heads of continuous
  1123	 * free pages of length of (1 << order) and marked with PageBuddy.
  1124	 * Page's order is recorded in page_private(page) field.
  1125	 * So when we are allocating or freeing one, we can derive the state of the
  1126	 * other.  That is, if we allocate a small block, and both were
  1127	 * free, the remainder of the region must be split into blocks.
  1128	 * If a block is freed, and its buddy is also free, then this
  1129	 * triggers coalescing into a block of larger size.
  1130	 *
  1131	 * -- nyc
  1132	 */
  1133	
  1134	static inline void __free_one_page(struct page *page,
  1135			unsigned long pfn,
  1136			struct zone *zone, unsigned int order,
  1137			int migratetype, fpi_t fpi_flags)
  1138	{
  1139		struct capture_control *capc = task_capc(zone);
  1140		unsigned long buddy_pfn = 0;
  1141		unsigned long combined_pfn;
  1142		struct page *buddy;
  1143		bool to_tail;
  1144		bool bypass = false;
  1145	
  1146		trace_android_vh_free_one_page_bypass(page, zone, order,
> 1147			migratetype, (int)fpi_flags, &bypass);
  1148	
  1149		if (bypass)
  1150			return;
  1151	
  1152		VM_BUG_ON(!zone_is_initialized(zone));
  1153		VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page);
  1154	
  1155		VM_BUG_ON(migratetype == -1);
  1156		if (likely(!is_migrate_isolate(migratetype)))
  1157			__mod_zone_freepage_state(zone, 1 << order, migratetype);
  1158	
  1159		VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page);
  1160		VM_BUG_ON_PAGE(bad_range(zone, page), page);
  1161	
  1162		while (order < MAX_ORDER - 1) {
  1163			if (compaction_capture(capc, page, order, migratetype)) {
  1164				__mod_zone_freepage_state(zone, -(1 << order),
  1165									migratetype);
  1166				return;
  1167			}
  1168	
  1169			buddy = find_buddy_page_pfn(page, pfn, order, &buddy_pfn);
  1170			if (!buddy)
  1171				goto done_merging;
  1172	
  1173			if (unlikely(order >= pageblock_order)) {
  1174				/*
  1175				 * We want to prevent merge between freepages on pageblock
  1176				 * without fallbacks and normal pageblock. Without this,
  1177				 * pageblock isolation could cause incorrect freepage or CMA
  1178				 * accounting or HIGHATOMIC accounting.
  1179				 */
  1180				int buddy_mt = get_pageblock_migratetype(buddy);
  1181	
  1182				if (migratetype != buddy_mt
  1183						&& (!migratetype_is_mergeable(migratetype) ||
  1184							!migratetype_is_mergeable(buddy_mt)))
  1185					goto done_merging;
  1186			}
  1187	
  1188			/*
  1189			 * Our buddy is free or it is CONFIG_DEBUG_PAGEALLOC guard page,
  1190			 * merge with it and move up one order.
  1191			 */
  1192			if (page_is_guard(buddy))
  1193				clear_page_guard(zone, buddy, order, migratetype);
  1194			else
  1195				del_page_from_free_list(buddy, zone, order);
  1196			combined_pfn = buddy_pfn & pfn;
  1197			page = page + (combined_pfn - pfn);
  1198			pfn = combined_pfn;
  1199			order++;
  1200		}
  1201	
  1202	done_merging:
  1203		set_buddy_order(page, order);
  1204	
  1205		if (fpi_flags & FPI_TO_TAIL)
  1206			to_tail = true;
  1207		else if (is_shuffle_order(order))
  1208			to_tail = shuffle_pick_tail();
  1209		else
  1210			to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order);
  1211	
  1212		if (to_tail)
  1213			add_to_free_list_tail(page, zone, order, migratetype);
  1214		else
  1215			add_to_free_list(page, zone, order, migratetype);
  1216	
  1217		/* Notify page reporting subsystem of freed page */
  1218		if (!(fpi_flags & FPI_SKIP_REPORT_NOTIFY))
  1219			page_reporting_notify_free(order);
  1220	}
  1221	

-- 
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:[~2025-06-14 15:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-14 15:18 [android-common:android14-6.1 1/1] mm/page_alloc.c:1147:31: sparse: sparse: cast from restricted fpi_t 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.