Skip to contentSkip to conversation

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

DISCUSSION Stephen Rothwell 2 participants 3 messages Nov 19, 2025 – Dec 4, 2025 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the arm64 tree got a conflict in:

mm/memory.c

between commit:

b08b123ead1a ("mm: avoid unnecessary use of is_swap_pmd()")

from the mm-unstable tree and commit:

79301c7d605a ("mm: add spurious fault fixing support for huge pmd")

from the arm64 tree.

I fixed it up (I think - 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.

Signature · 76 lines
Cheers,
Stephen Rothwell

diff --cc mm/memory.c
index 50b93b45b174,6e5a08c4fd2e..000000000000
--- a/mm/memory.c
+++ b/mm/memory.c
@@@ -6342,40 -6314,37 +6369,43 @@@ retry_pud
  	if (pmd_none(*vmf.pmd) &&
  	    thp_vma_allowable_order(vma, vm_flags, TVA_PAGEFAULT, PMD_ORDER)) {
  		ret = create_huge_pmd(&vmf);
 -		if (!(ret & VM_FAULT_FALLBACK))
 +		if (ret & VM_FAULT_FALLBACK)
 +			goto fallback;
 +		else
  			return ret;
 -	} else {
 -		vmf.orig_pmd = pmdp_get_lockless(vmf.pmd);
 +	}
  
 -		if (unlikely(is_swap_pmd(vmf.orig_pmd))) {
 -			VM_BUG_ON(thp_migration_supported() &&
 -					  !is_pmd_migration_entry(vmf.orig_pmd));
 -			if (is_pmd_migration_entry(vmf.orig_pmd))
 -				pmd_migration_entry_wait(mm, vmf.pmd);
 +	vmf.orig_pmd = pmdp_get_lockless(vmf.pmd);
 +	if (pmd_none(vmf.orig_pmd))
 +		goto fallback;
 +
 +	if (unlikely(!pmd_present(vmf.orig_pmd))) {
 +		if (pmd_is_device_private_entry(vmf.orig_pmd))
 +			return do_huge_pmd_device_private(&vmf);
 +
 +		if (pmd_is_migration_entry(vmf.orig_pmd))
 +			pmd_migration_entry_wait(mm, vmf.pmd);
 +		return 0;
 +	}
 +	if (pmd_trans_huge(vmf.orig_pmd)) {
 +		if (pmd_protnone(vmf.orig_pmd) && vma_is_accessible(vma))
 +			return do_huge_pmd_numa_page(&vmf);
 +
 +		if ((flags & (FAULT_FLAG_WRITE|FAULT_FLAG_UNSHARE)) &&
 +		    !pmd_write(vmf.orig_pmd)) {
 +			ret = wp_huge_pmd(&vmf);
 +			if (!(ret & VM_FAULT_FALLBACK))
 +				return ret;
 +		} else {
- 			huge_pmd_set_accessed(&vmf);
++			vmf.ptl = pmd_lock(mm, vmf.pmd);
++			if (!huge_pmd_set_accessed(&vmf))
++				fix_spurious_fault(&vmf, PGTABLE_LEVEL_PMD);
++			spin_unlock(vmf.ptl);
  			return 0;
  		}
 -		if (pmd_trans_huge(vmf.orig_pmd)) {
 -			if (pmd_protnone(vmf.orig_pmd) && vma_is_accessible(vma))
 -				return do_huge_pmd_numa_page(&vmf);
 -
 -			if ((flags & (FAULT_FLAG_WRITE|FAULT_FLAG_UNSHARE)) &&
 -			    !pmd_write(vmf.orig_pmd)) {
 -				ret = wp_huge_pmd(&vmf);
 -				if (!(ret & VM_FAULT_FALLBACK))
 -					return ret;
 -			} else {
 -				vmf.ptl = pmd_lock(mm, vmf.pmd);
 -				if (!huge_pmd_set_accessed(&vmf))
 -					fix_spurious_fault(&vmf, PGTABLE_LEVEL_PMD);
 -				spin_unlock(vmf.ptl);
 -				return 0;
 -			}
 -		}
  	}
  
 +fallback:
  	return handle_pte_fault(&vmf);
  }
#1 lore raw

Hi, Stephen,

Quoted 14 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the arm64 tree got a conflict in:

mm/memory.c

between commit:

b08b123ead1a ("mm: avoid unnecessary use of is_swap_pmd()")

from the mm-unstable tree and commit:

79301c7d605a ("mm: add spurious fault fixing support for huge pmd")

Quoted 8 lines

from the arm64 tree.

I fixed it up (I think - 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.

The fix looks right to me. Thanks!

---
Best Regards,
Huang, Ying

#2 lore raw
In reply to Stephen Rothwell

Hi all,

Quoted 87 lines · On Thu, 20 Nov 2025 10:25:32 +1100 Stephen Rothwell <[email protected]>…

Today's linux-next merge of the arm64 tree got a conflict in:

mm/memory.c

between commit:

b08b123ead1a ("mm: avoid unnecessary use of is_swap_pmd()")

from the mm-unstable tree and commit:

79301c7d605a ("mm: add spurious fault fixing support for huge pmd")

from the arm64 tree.

I fixed it up (I think - 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.

mm/memory.c +4 -1
diff --cc mm/memory.c
index 50b93b45b174,6e5a08c4fd2e..000000000000
@@@ -6342,40 -6314,37 +6369,43 @@@ retry_pud
  	if (pmd_none(*vmf.pmd) &&
  	    thp_vma_allowable_order(vma, vm_flags, TVA_PAGEFAULT, PMD_ORDER)) {
  		ret = create_huge_pmd(&vmf);
 -		if (!(ret & VM_FAULT_FALLBACK))
 +		if (ret & VM_FAULT_FALLBACK)
 +			goto fallback;
 +		else
  			return ret;
 -	} else {
 -		vmf.orig_pmd = pmdp_get_lockless(vmf.pmd);
 +	}
 
 -		if (unlikely(is_swap_pmd(vmf.orig_pmd))) {
 -			VM_BUG_ON(thp_migration_supported() &&
 -					  !is_pmd_migration_entry(vmf.orig_pmd));
 -			if (is_pmd_migration_entry(vmf.orig_pmd))
 -				pmd_migration_entry_wait(mm, vmf.pmd);
 +	vmf.orig_pmd = pmdp_get_lockless(vmf.pmd);
 +	if (pmd_none(vmf.orig_pmd))
 +		goto fallback;
 +
 +	if (unlikely(!pmd_present(vmf.orig_pmd))) {
 +		if (pmd_is_device_private_entry(vmf.orig_pmd))
 +			return do_huge_pmd_device_private(&vmf);
 +
 +		if (pmd_is_migration_entry(vmf.orig_pmd))
 +			pmd_migration_entry_wait(mm, vmf.pmd);
 +		return 0;
 +	}
 +	if (pmd_trans_huge(vmf.orig_pmd)) {
 +		if (pmd_protnone(vmf.orig_pmd) && vma_is_accessible(vma))
 +			return do_huge_pmd_numa_page(&vmf);
 +
 +		if ((flags & (FAULT_FLAG_WRITE|FAULT_FLAG_UNSHARE)) &&
 +		    !pmd_write(vmf.orig_pmd)) {
 +			ret = wp_huge_pmd(&vmf);
 +			if (!(ret & VM_FAULT_FALLBACK))
 +				return ret;
 +		} else {
- 			huge_pmd_set_accessed(&vmf);
++			vmf.ptl = pmd_lock(mm, vmf.pmd);
++			if (!huge_pmd_set_accessed(&vmf))
++				fix_spurious_fault(&vmf, PGTABLE_LEVEL_PMD);
++			spin_unlock(vmf.ptl);
  			return 0;
  		}
 -		if (pmd_trans_huge(vmf.orig_pmd)) {
 -			if (pmd_protnone(vmf.orig_pmd) && vma_is_accessible(vma))
 -				return do_huge_pmd_numa_page(&vmf);
 -
 -			if ((flags & (FAULT_FLAG_WRITE|FAULT_FLAG_UNSHARE)) &&
 -			    !pmd_write(vmf.orig_pmd)) {
 -				ret = wp_huge_pmd(&vmf);
 -				if (!(ret & VM_FAULT_FALLBACK))
 -					return ret;
 -			} else {
 -				vmf.ptl = pmd_lock(mm, vmf.pmd);
 -				if (!huge_pmd_set_accessed(&vmf))

mm/memory.c

Quoted 10 lines
mm/memory.c +0 -0
 -					fix_spurious_fault(&vmf, PGTABLE_LEVEL_PMD);
 -				spin_unlock(vmf.ptl);
 -				return 0;
 -			}
 -		}
  	}
 
 +fallback:
  	return handle_pte_fault(&vmf);
  }

This is now a conflict between the mm-stable tree and Linus' tree.

Signature · 2 lines
Cheers,
Stephen Rothwell