Subject: linux-next: manual merge of the mm tree with the block tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 10 Nov 2022 17:55:52 +1100

Hi all,

Today's linux-next merge of the mm tree got conflicts in:

  mm/gup.c
  mm/huge_memory.c

between commits:

  0f0892356fa1 ("mm: allow multiple error returns in try_grab_page()")
  4003f107fa2e ("mm: introduce FOLL_PCI_P2PDMA to gate getting PCI P2PDMA pages")

from the block tree and commit:

  7928e6cb4ec6 ("mm/gup: drop DAX pgmap accounting")

from the mm 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.

-- 
Cheers,
Stephen Rothwell

diff --cc mm/gup.c
index 8a4b1a783cb6,5182abaaecde..000000000000
--- a/mm/gup.c
+++ b/mm/gup.c
@@@ -2482,26 -2394,10 +2406,13 @@@ static int __gup_device_huge(unsigned l
  	do {
  		struct page *page = pfn_to_page(pfn);
  
- 		pgmap = get_dev_pagemap(pfn, pgmap);
- 		if (unlikely(!pgmap)) {
- 			undo_dev_pagemap(nr, nr_start, flags, pages);
- 			break;
- 		}
- 
- 		if (!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(page)) {
- 			undo_dev_pagemap(nr, nr_start, flags, pages);
++		if (!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(page))
 +			break;
- 		}
 +
  		SetPageReferenced(page);
  		pages[*nr] = page;
- 		if (unlikely(try_grab_page(page, flags))) {
- 			undo_dev_pagemap(nr, nr_start, flags, pages);
 -		if (unlikely(!try_grab_page(page, flags)))
++		if (unlikely(try_grab_page(page, flags)))
  			break;
- 		}
  		(*nr)++;
  		pfn++;
  	} while (addr += PAGE_SIZE, addr != end);
diff --cc mm/huge_memory.c
index a075e3803e5e,ed12cd3acbfd..000000000000
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@@ -1225,14 -1179,9 +1180,11 @@@ struct page *follow_devmap_pud(struct v
  		return ERR_PTR(-EEXIST);
  
  	pfn += (addr & ~PUD_MASK) >> PAGE_SHIFT;
- 	*pgmap = get_dev_pagemap(pfn, *pgmap);
- 	if (!*pgmap)
- 		return ERR_PTR(-EFAULT);
  	page = pfn_to_page(pfn);
 -	if (!try_grab_page(page, flags))
 -		page = ERR_PTR(-ENOMEM);
 +
 +	ret = try_grab_page(page, flags);
 +	if (ret)
 +		page = ERR_PTR(ret);
  
  	return page;
  }