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

From: Stephen Rothwell <[email-masked]>
Date: Fri, 16 Jun 2023 11:50:58 +1000

Hi all,

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

  include/linux/mm.h

between commit:

  3ed01074f441 ("mm: remove is_longterm_pinnable_page() and Reimplement folio_is_longterm_pinnable()")

from the mm tree and commit:

  c8070b787519 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")

from the block tree.

I fixed it up (I thinkl - 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 include/linux/mm.h
index e3e047735ccc,200068d98686..000000000000
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@@ -1902,18 -1910,40 +1902,40 @@@ static inline bool page_needs_cow_for_d
  	return page_maybe_dma_pinned(page);
  }
  
+ /**
+  * is_zero_page - Query if a page is a zero page
+  * @page: The page to query
+  *
+  * This returns true if @page is one of the permanent zero pages.
+  */
+ static inline bool is_zero_page(const struct page *page)
+ {
+ 	return is_zero_pfn(page_to_pfn(page));
+ }
+ 
+ /**
+  * is_zero_folio - Query if a folio is a zero page
+  * @folio: The folio to query
+  *
+  * This returns true if @folio is one of the permanent zero pages.
+  */
+ static inline bool is_zero_folio(const struct folio *folio)
+ {
+ 	return is_zero_page(&folio->page);
+ }
+ 
 -/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin pages */
 +/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin folios */
  #ifdef CONFIG_MIGRATION
 -static inline bool is_longterm_pinnable_page(struct page *page)
 +static inline bool folio_is_longterm_pinnable(struct folio *folio)
  {
  #ifdef CONFIG_CMA
 -	int mt = get_pageblock_migratetype(page);
 +	int mt = folio_migratetype(folio);
  
  	if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE)
  		return false;
  #endif
- 	/* The zero page may always be pinned */
- 	if (is_zero_pfn(folio_pfn(folio)))
+ 	/* The zero page can be "pinned" but gets special handling. */
 -	if (is_zero_page(page))
++	if (is_zero_folio(folio))
  		return true;
  
  	/* Coherent device memory must always allow eviction. */