Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sourav Panda <souravpanda@google.com>,
	muchun.song@linux.dev, osalvador@suse.de,
	akpm@linux-foundation.org
Cc: oe-kbuild-all@lists.linux.dev, david@kernel.org,
	surenb@google.com, fvdl@google.com, gthelen@google.com,
	souravpanda@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm/hugetlb_cma: support percentage-based hugetlb_cma reservation
Date: Fri, 26 Jun 2026 20:18:32 +0800	[thread overview]
Message-ID: <202606262023.IKUrn01I-lkp@intel.com> (raw)
In-Reply-To: <20260625215900.2151690-1-souravpanda@google.com>

Hi Sourav,

kernel test robot noticed the following build errors:

[auto build test ERROR on v7.1]
[also build test ERROR on linus/master]
[cannot apply to akpm-mm/mm-everything]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sourav-Panda/mm-hugetlb_cma-support-percentage-based-hugetlb_cma-reservation/20260626-060014
base:   v7.1
patch link:    https://lore.kernel.org/r/20260625215900.2151690-1-souravpanda%40google.com
patch subject: [PATCH v1] mm/hugetlb_cma: support percentage-based hugetlb_cma reservation
config: i386-randconfig-062-20260626 (https://download.01.org/0day-ci/archive/20260626/202606262023.IKUrn01I-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260626/202606262023.IKUrn01I-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/202606262023.IKUrn01I-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: mm/hugetlb_cma.o: in function `hugetlb_cma_reserve':
>> mm/hugetlb_cma.c:219:(.init.text+0x21b): undefined reference to `__udivmoddi4'
>> ld: mm/hugetlb_cma.c:219:(.init.text+0x22f): undefined reference to `__udivdi3'

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for MFD_STMFX
   Depends on [n]: HAS_IOMEM [=y] && I2C [=y] && OF [=n]
   Selected by [y]:
   - PINCTRL_STMFX [=y] && PINCTRL [=y] && I2C [=y] && HAS_IOMEM [=y]


vim +219 mm/hugetlb_cma.c

   189	
   190	void __init hugetlb_cma_reserve(void)
   191	{
   192		unsigned long size, reserved, per_node, order;
   193		bool node_specific_cma_alloc = false;
   194		bool has_node_specific_param = false;
   195		int nid;
   196	
   197		for (nid = 0; nid < MAX_NUMNODES; nid++) {
   198			if (hugetlb_cma_size_in_node[nid] || hugetlb_cma_percent_in_node[nid]) {
   199				has_node_specific_param = true;
   200				break;
   201			}
   202		}
   203	
   204		if (has_node_specific_param) {
   205			for (nid = 0; nid < MAX_NUMNODES; nid++) {
   206				if (hugetlb_cma_percent_in_node[nid]) {
   207					unsigned long node_gfp_mem = memblock_node_memory_size(nid);
   208					unsigned long s;
   209	
   210					s = mult_frac(node_gfp_mem,
   211						      hugetlb_cma_percent_in_node[nid],
   212						      100);
   213	
   214					hugetlb_cma_size_in_node[nid] = s;
   215					hugetlb_cma_size += s;
   216				}
   217			}
   218		} else if (hugetlb_cma_percent) {
 > 219			hugetlb_cma_size = mult_frac(memblock_phys_mem_size(), hugetlb_cma_percent, 100);
   220		}
   221	
   222		if (!hugetlb_cma_size)
   223			return;
   224	
   225		order = arch_hugetlb_cma_order();
   226		if (!order) {
   227			pr_warn("hugetlb_cma: the option isn't supported by current arch\n");
   228			return;
   229		}
   230	
   231		/*
   232		 * HugeTLB CMA reservation is required for gigantic
   233		 * huge pages which could not be allocated via the
   234		 * page allocator. Just warn if there is any change
   235		 * breaking this assumption.
   236		 */
   237		VM_WARN_ON(order <= MAX_PAGE_ORDER);
   238	
   239		hugetlb_bootmem_set_nodes();
   240	
   241		for (nid = 0; nid < MAX_NUMNODES; nid++) {
   242			if (hugetlb_cma_size_in_node[nid] == 0)
   243				continue;
   244	
   245			if (!node_isset(nid, hugetlb_bootmem_nodes)) {
   246				pr_warn("hugetlb_cma: invalid node %d specified\n", nid);
   247				hugetlb_cma_size -= hugetlb_cma_size_in_node[nid];
   248				hugetlb_cma_size_in_node[nid] = 0;
   249				continue;
   250			}
   251	
   252			if (hugetlb_cma_size_in_node[nid] < (PAGE_SIZE << order)) {
   253				pr_warn("hugetlb_cma: cma area of node %d should be at least %lu MiB\n",
   254					nid, (PAGE_SIZE << order) / SZ_1M);
   255				hugetlb_cma_size -= hugetlb_cma_size_in_node[nid];
   256				hugetlb_cma_size_in_node[nid] = 0;
   257			} else {
   258				node_specific_cma_alloc = true;
   259			}
   260		}
   261	
   262		/* Validate the CMA size again in case some invalid nodes specified. */
   263		if (!hugetlb_cma_size)
   264			return;
   265	
   266		if (hugetlb_cma_size < (PAGE_SIZE << order)) {
   267			pr_warn("hugetlb_cma: cma area should be at least %lu MiB\n",
   268				(PAGE_SIZE << order) / SZ_1M);
   269			hugetlb_cma_size = 0;
   270			return;
   271		}
   272	
   273		if (!node_specific_cma_alloc) {
   274			/*
   275			 * If 3 GB area is requested on a machine with 4 numa nodes,
   276			 * let's allocate 1 GB on first three nodes and ignore the last one.
   277			 */
   278			per_node = DIV_ROUND_UP(hugetlb_cma_size,
   279						nodes_weight(hugetlb_bootmem_nodes));
   280			per_node = round_up(per_node, PAGE_SIZE << order);
   281			pr_info("hugetlb_cma: reserve %lu MiB, up to %lu MiB per node\n",
   282				hugetlb_cma_size / SZ_1M, per_node / SZ_1M);
   283		}
   284	
   285		reserved = 0;
   286		for_each_node_mask(nid, hugetlb_bootmem_nodes) {
   287			int res;
   288			char name[CMA_MAX_NAME];
   289	
   290			if (node_specific_cma_alloc) {
   291				if (hugetlb_cma_size_in_node[nid] == 0)
   292					continue;
   293	
   294				size = hugetlb_cma_size_in_node[nid];
   295			} else {
   296				size = min(per_node, hugetlb_cma_size - reserved);
   297			}
   298	
   299			size = round_up(size, PAGE_SIZE << order);
   300	
   301			snprintf(name, sizeof(name), "hugetlb%d", nid);
   302			/*
   303			 * Note that 'order per bit' is based on smallest size that
   304			 * may be returned to CMA allocator in the case of
   305			 * huge page demotion.
   306			 */
   307			res = cma_declare_contiguous_multi(size, PAGE_SIZE << order,
   308						HUGETLB_PAGE_ORDER, name,
   309						&hugetlb_cma[nid], nid);
   310			if (res) {
   311				pr_warn("hugetlb_cma: reservation failed: err %d, node %d",
   312					res, nid);
   313				continue;
   314			}
   315	
   316			reserved += size;
   317			pr_info("hugetlb_cma: reserved %lu MiB on node %d\n",
   318				size / SZ_1M, nid);
   319	
   320			if (reserved >= hugetlb_cma_size)
   321				break;
   322		}
   323	
   324		if (!reserved)
   325			/*
   326			 * hugetlb_cma_size is used to determine if allocations from
   327			 * cma are possible.  Set to zero if no cma regions are set up.
   328			 */
   329			hugetlb_cma_size = 0;
   330	}
   331	

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


      reply	other threads:[~2026-06-26 12:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 21:59 [PATCH v1] mm/hugetlb_cma: support percentage-based hugetlb_cma reservation Sourav Panda
2026-06-26 12:18 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202606262023.IKUrn01I-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=fvdl@google.com \
    --cc=gthelen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=souravpanda@google.com \
    --cc=surenb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox