linux-next: manual merge of the mm-nonmm-unstable tree with the origin tree

Mark Brown posted 1 patch 5 days, 17 hours ago
linux-next: manual merge of the mm-nonmm-unstable tree with the origin tree
Posted by Mark Brown 5 days, 17 hours ago
Hi all,

Today's linux-next merge of the mm-nonmm-unstable tree got a conflict in:

  mm/hugetlb_cma.c

between commits:

  8f5ce56b76303 ("mm/hugetlb_cma: round up per_node before logging it")
  4d33b7a0c04bf ("mm/hugetlb_cma: restrict hugetlb_cma parameter to gigantic-page alignment")

from the origin tree and commit:

  2638c879e1082 ("mm/hugetlb_cma: round up per_node before logging it")

from the mm-nonmm-unstable tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --combined mm/hugetlb_cma.c
index 39344d6c78d84,7693ccefd0c64..0000000000000
--- a/mm/hugetlb_cma.c
+++ b/mm/hugetlb_cma.c
@@@ -142,7 -142,7 +142,7 @@@ unsigned int __weak arch_hugetlb_cma_or
  
  void __init hugetlb_cma_reserve(void)
  {
 -	unsigned long size, reserved, per_node, order;
 +	unsigned long size, reserved, per_node, order, gigantic_page_size;
  	bool node_specific_cma_alloc = false;
  	int nid;
  
@@@ -162,36 -162,37 +162,36 @@@
  	 * breaking this assumption.
  	 */
  	VM_WARN_ON(order <= MAX_PAGE_ORDER);
 +	gigantic_page_size = PAGE_SIZE << order;
  
  	hugetlb_bootmem_set_nodes();
  
  	for (nid = 0; nid < MAX_NUMNODES; nid++) {
 -		if (hugetlb_cma_size_in_node[nid] == 0)
 +		size = hugetlb_cma_size_in_node[nid];
 +		if (size == 0)
  			continue;
  
  		if (!node_isset(nid, hugetlb_bootmem_nodes)) {
  			pr_warn("hugetlb_cma: invalid node %d specified\n", nid);
 -			hugetlb_cma_size -= hugetlb_cma_size_in_node[nid];
 -			hugetlb_cma_size_in_node[nid] = 0;
 +		} else if (!IS_ALIGNED(size, gigantic_page_size)) {
 +			pr_warn("hugetlb_cma: cma area of node %d must be a multiple of %lu MiB\n",
 +				nid, gigantic_page_size / SZ_1M);
 +		} else {
 +			node_specific_cma_alloc = true;
  			continue;
  		}
  
 -		if (hugetlb_cma_size_in_node[nid] < (PAGE_SIZE << order)) {
 -			pr_warn("hugetlb_cma: cma area of node %d should be at least %lu MiB\n",
 -				nid, (PAGE_SIZE << order) / SZ_1M);
 -			hugetlb_cma_size -= hugetlb_cma_size_in_node[nid];
 -			hugetlb_cma_size_in_node[nid] = 0;
 -		} else {
 -			node_specific_cma_alloc = true;
 -		}
 +		hugetlb_cma_size -= size;
 +		hugetlb_cma_size_in_node[nid] = 0;
  	}
  
  	/* Validate the CMA size again in case some invalid nodes specified. */
  	if (!hugetlb_cma_size)
  		return;
  
 -	if (hugetlb_cma_size < (PAGE_SIZE << order)) {
 -		pr_warn("hugetlb_cma: cma area should be at least %lu MiB\n",
 -			(PAGE_SIZE << order) / SZ_1M);
 +	if (!IS_ALIGNED(hugetlb_cma_size, gigantic_page_size)) {
 +		pr_warn("hugetlb_cma: cma area must be a multiple of %lu MiB\n",
 +			gigantic_page_size / SZ_1M);
  		hugetlb_cma_size = 0;
  		return;
  	}
@@@ -203,7 -204,7 +203,7 @@@
  		 */
  		per_node = DIV_ROUND_UP(hugetlb_cma_size,
  					nodes_weight(hugetlb_bootmem_nodes));
 -		per_node = round_up(per_node, PAGE_SIZE << order);
 +		per_node = round_up(per_node, gigantic_page_size);
  		pr_info("hugetlb_cma: reserve %lu MiB, up to %lu MiB per node\n",
  			hugetlb_cma_size / SZ_1M, per_node / SZ_1M);
  	}
@@@ -222,13 -223,15 +222,13 @@@
  			size = min(per_node, hugetlb_cma_size - reserved);
  		}
  
 -		size = round_up(size, PAGE_SIZE << order);
 -
  		snprintf(name, sizeof(name), "hugetlb%d", nid);
  		/*
  		 * Note that 'order per bit' is based on smallest size that
  		 * may be returned to CMA allocator in the case of
  		 * huge page demotion.
  		 */
 -		res = cma_declare_contiguous_multi(size, PAGE_SIZE << order,
 +		res = cma_declare_contiguous_multi(size, gigantic_page_size,
  					HUGETLB_PAGE_ORDER, name,
  					&hugetlb_cma[nid], nid);
  		if (res) {
Re: linux-next: manual merge of the mm-nonmm-unstable tree with the origin tree
Posted by Andrew Morton 5 days, 8 hours ago
On Tue, 19 May 2026 10:32:26 +0100 Mark Brown <broonie@kernel.org> wrote:

> Hi all,
> 
> Today's linux-next merge of the mm-nonmm-unstable tree got a conflict in:
> 
>   mm/hugetlb_cma.c
> 
> between commits:
> 
>   8f5ce56b76303 ("mm/hugetlb_cma: round up per_node before logging it")
>   4d33b7a0c04bf ("mm/hugetlb_cma: restrict hugetlb_cma parameter to gigantic-page alignment")
> 
> from the origin tree

Actually these are in mm.git.

The first was in mm-hotfixes-stable and is now in mainline.

The second remains in mm-unstable.

> and commit:
> 
>   2638c879e1082 ("mm/hugetlb_cma: round up per_node before logging it")
> 
> from the mm-nonmm-unstable tree.

This duplicate was in mm-hotfixes-stable, now upstream;

> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 

Or something like that ;)  I guess there's a timing issue here, it should all
come good soon.