[gourryinverse:scratch/gourry/managed_nodes/node_features_v6 42/44] mm/page_alloc.c:7717 alloc_contig_frozen_pages_noprof() warn: bitwise AND condition is false here
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild |
|---|---|
| Message-ID | <[email protected]> |
BCC: [email protected] CC: [email protected] CC: Gregory Price <[email protected]> TO: Gregory Price <[email protected]> tree: https://github.com/gourryinverse/linux scratch/gourry/managed_nodes/node_features_v6 head: 38c7f48162aa282dc6a9edfb7011378594057c10 commit: e349bc96af39536035720fe607b05fc4cbd269fc [42/44] mm/page_alloc: let a contiguous search target a private node :::::: branch date: 2 days ago :::::: commit date: 2 days ago config: i386-randconfig-r073-20260822 (https://download.01.org/0day-ci/archive/20260822/[email protected]/config) compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211) 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 | Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/ smatch warnings: mm/page_alloc.c:7717 alloc_contig_frozen_pages_noprof() warn: bitwise AND condition is false here vim +7717 mm/page_alloc.c 5e27a2df03b893 Anshuman Khandual 2019-11-30 7671 5e27a2df03b893 Anshuman Khandual 2019-11-30 7672 /** e0c1326779cc1b Kefeng Wang 2026-01-09 7673 * alloc_contig_frozen_pages() -- tries to find and allocate contiguous range of frozen pages 5e27a2df03b893 Anshuman Khandual 2019-11-30 7674 * @nr_pages: Number of contiguous pages to allocate f6037a4a686523 David Hildenbrand 2024-12-03 7675 * @gfp_mask: GFP mask. Node/zone/placement hints limit the search; only some f6037a4a686523 David Hildenbrand 2024-12-03 7676 * action and reclaim modifiers are supported. Reclaim modifiers f6037a4a686523 David Hildenbrand 2024-12-03 7677 * control allocation behavior during compaction/migration/reclaim. 5e27a2df03b893 Anshuman Khandual 2019-11-30 7678 * @nid: Target node 5e27a2df03b893 Anshuman Khandual 2019-11-30 7679 * @nodemask: Mask for other possible nodes 5e27a2df03b893 Anshuman Khandual 2019-11-30 7680 * e0c1326779cc1b Kefeng Wang 2026-01-09 7681 * This routine is a wrapper around alloc_contig_frozen_range(). It scans over e0c1326779cc1b Kefeng Wang 2026-01-09 7682 * zones on an applicable zonelist to find a contiguous pfn range which can then e0c1326779cc1b Kefeng Wang 2026-01-09 7683 * be tried for allocation with alloc_contig_frozen_range(). This routine is e0c1326779cc1b Kefeng Wang 2026-01-09 7684 * intended for allocation requests which can not be fulfilled with the buddy e0c1326779cc1b Kefeng Wang 2026-01-09 7685 * allocator. 5e27a2df03b893 Anshuman Khandual 2019-11-30 7686 * 5e27a2df03b893 Anshuman Khandual 2019-11-30 7687 * The allocated memory is always aligned to a page boundary. If nr_pages is a eaab8e753632b8 Anshuman Khandual 2022-01-14 7688 * power of two, then allocated range is also guaranteed to be aligned to same eaab8e753632b8 Anshuman Khandual 2022-01-14 7689 * nr_pages (e.g. 1GB request would be aligned to 1GB). 5e27a2df03b893 Anshuman Khandual 2019-11-30 7690 * e0c1326779cc1b Kefeng Wang 2026-01-09 7691 * Allocated frozen pages need be freed with free_contig_frozen_range(), e0c1326779cc1b Kefeng Wang 2026-01-09 7692 * or by manually calling free_frozen_pages() on each allocated frozen e0c1326779cc1b Kefeng Wang 2026-01-09 7693 * non-compound page, for compound frozen pages could be freed with e0c1326779cc1b Kefeng Wang 2026-01-09 7694 * free_frozen_pages() directly. 5e27a2df03b893 Anshuman Khandual 2019-11-30 7695 * e0c1326779cc1b Kefeng Wang 2026-01-09 7696 * Return: pointer to contiguous frozen pages on success, or NULL if not successful. 5e27a2df03b893 Anshuman Khandual 2019-11-30 7697 */ e0c1326779cc1b Kefeng Wang 2026-01-09 7698 struct page *alloc_contig_frozen_pages_noprof(unsigned long nr_pages, e349bc96af3953 Gregory Price 2026-08-19 7699 gfp_t gfp_mask, int nid, nodemask_t *nodemask, e349bc96af3953 Gregory Price 2026-08-19 7700 unsigned int alloc_flags) 5e27a2df03b893 Anshuman Khandual 2019-11-30 7701 { 5e27a2df03b893 Anshuman Khandual 2019-11-30 7702 unsigned long ret, pfn, flags; 5e27a2df03b893 Anshuman Khandual 2019-11-30 7703 struct zonelist *zonelist; 5e27a2df03b893 Anshuman Khandual 2019-11-30 7704 struct zone *zone; 5e27a2df03b893 Anshuman Khandual 2019-11-30 7705 struct zoneref *z; e349bc96af3953 Gregory Price 2026-08-19 7706 nodemask_t targets; 3bb64898f00368 Gregory Price 2025-12-21 7707 bool skip_hugetlb = true; 3bb64898f00368 Gregory Price 2025-12-21 7708 bool skipped_hugetlb = false; 5e27a2df03b893 Anshuman Khandual 2019-11-30 7709 e349bc96af3953 Gregory Price 2026-08-19 7710 /* e349bc96af3953 Gregory Price 2026-08-19 7711 * ALLOC_ZONELIST_PRIVATE grants the search access to private nodes, e349bc96af3953 Gregory Price 2026-08-19 7712 * but the private zonelist is built over all of N_MEMORY, so without e349bc96af3953 Gregory Price 2026-08-19 7713 * a nodemask it would also offer up other devices' nodes. Confine it e349bc96af3953 Gregory Price 2026-08-19 7714 * to @nid and the public nodes. A caller that supplied its own e349bc96af3953 Gregory Price 2026-08-19 7715 * nodemask has already said what it will accept. e349bc96af3953 Gregory Price 2026-08-19 7716 */ e349bc96af3953 Gregory Price 2026-08-19 @7717 if ((alloc_flags & ALLOC_ZONELIST_PRIVATE) && !nodemask && e349bc96af3953 Gregory Price 2026-08-19 7718 contig_private_targets(nid, &targets)) e349bc96af3953 Gregory Price 2026-08-19 7719 nodemask = &targets; e349bc96af3953 Gregory Price 2026-08-19 7720 3bb64898f00368 Gregory Price 2025-12-21 7721 retry: e349bc96af3953 Gregory Price 2026-08-19 7722 zonelist = select_zonelist(nid, gfp_mask, alloc_flags); 5e27a2df03b893 Anshuman Khandual 2019-11-30 7723 for_each_zone_zonelist_nodemask(zone, z, zonelist, 5e27a2df03b893 Anshuman Khandual 2019-11-30 7724 gfp_zone(gfp_mask), nodemask) { 5e27a2df03b893 Anshuman Khandual 2019-11-30 7725 spin_lock_irqsave(&zone->lock, flags); 5e27a2df03b893 Anshuman Khandual 2019-11-30 7726 5e27a2df03b893 Anshuman Khandual 2019-11-30 7727 pfn = ALIGN(zone->zone_start_pfn, nr_pages); 5e27a2df03b893 Anshuman Khandual 2019-11-30 7728 while (zone_spans_last_pfn(zone, pfn, nr_pages)) { 3bb64898f00368 Gregory Price 2025-12-21 7729 if (pfn_range_valid_contig(zone, pfn, nr_pages, 3bb64898f00368 Gregory Price 2025-12-21 7730 skip_hugetlb, 3bb64898f00368 Gregory Price 2025-12-21 7731 &skipped_hugetlb)) { 5e27a2df03b893 Anshuman Khandual 2019-11-30 7732 /* 5e27a2df03b893 Anshuman Khandual 2019-11-30 7733 * We release the zone lock here because e0c1326779cc1b Kefeng Wang 2026-01-09 7734 * alloc_contig_frozen_range() will also lock e0c1326779cc1b Kefeng Wang 2026-01-09 7735 * the zone at some point. If there's an e0c1326779cc1b Kefeng Wang 2026-01-09 7736 * allocation spinning on this lock, it may e0c1326779cc1b Kefeng Wang 2026-01-09 7737 * win the race and cause allocation to fail. 5e27a2df03b893 Anshuman Khandual 2019-11-30 7738 */ 5e27a2df03b893 Anshuman Khandual 2019-11-30 7739 spin_unlock_irqrestore(&zone->lock, flags); e0c1326779cc1b Kefeng Wang 2026-01-09 7740 ret = alloc_contig_frozen_range_noprof(pfn, e0c1326779cc1b Kefeng Wang 2026-01-09 7741 pfn + nr_pages, e0c1326779cc1b Kefeng Wang 2026-01-09 7742 ACR_FLAGS_NONE, 5e27a2df03b893 Anshuman Khandual 2019-11-30 7743 gfp_mask); 5e27a2df03b893 Anshuman Khandual 2019-11-30 7744 if (!ret) 5e27a2df03b893 Anshuman Khandual 2019-11-30 7745 return pfn_to_page(pfn); 5e27a2df03b893 Anshuman Khandual 2019-11-30 7746 spin_lock_irqsave(&zone->lock, flags); 5e27a2df03b893 Anshuman Khandual 2019-11-30 7747 } 5e27a2df03b893 Anshuman Khandual 2019-11-30 7748 pfn += nr_pages; 5e27a2df03b893 Anshuman Khandual 2019-11-30 7749 } 5e27a2df03b893 Anshuman Khandual 2019-11-30 7750 spin_unlock_irqrestore(&zone->lock, flags); 5e27a2df03b893 Anshuman Khandual 2019-11-30 7751 } 3bb64898f00368 Gregory Price 2025-12-21 7752 /* 3bb64898f00368 Gregory Price 2025-12-21 7753 * If we failed, retry the search, but treat regions with HugeTLB pages 3bb64898f00368 Gregory Price 2025-12-21 7754 * as valid targets. This retains fast-allocations on first pass 3bb64898f00368 Gregory Price 2025-12-21 7755 * without trying to migrate HugeTLB pages (which may fail). On the 3bb64898f00368 Gregory Price 2025-12-21 7756 * second pass, we will try moving HugeTLB pages when those pages are 3bb64898f00368 Gregory Price 2025-12-21 7757 * smaller than the requested contiguous region size. 3bb64898f00368 Gregory Price 2025-12-21 7758 */ 3bb64898f00368 Gregory Price 2025-12-21 7759 if (skip_hugetlb && skipped_hugetlb) { 3bb64898f00368 Gregory Price 2025-12-21 7760 skip_hugetlb = false; 3bb64898f00368 Gregory Price 2025-12-21 7761 goto retry; 3bb64898f00368 Gregory Price 2025-12-21 7762 } 5e27a2df03b893 Anshuman Khandual 2019-11-30 7763 return NULL; 5e27a2df03b893 Anshuman Khandual 2019-11-30 7764 } e0c1326779cc1b Kefeng Wang 2026-01-09 7765 EXPORT_SYMBOL(alloc_contig_frozen_pages_noprof); 041d3a8cdc18dc Michal Nazarewicz 2011-12-29 7766 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki