Subject: linux-next: manual merge of the akpm-current tree with the folio tree

From: [email-masked]
Date: Fri, 10 Dec 2021 21:17:11 +0000

Hi all,

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

  mm/migrate.c

between commit:

  2871d169178ba ("filemap: Add folio_put_wait_locked()")

from the folio tree and commit:

  dfbfdd72f50ce ("mm/migrate.c: rework migration_entry_wait() to not take a pageref")

from the akpm-current 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 --cc mm/migrate.c
index 7079e6b7dbe7d,d487a399253b0..0000000000000
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@@ -302,17 -303,10 +303,9 @@@ void __migration_entry_wait(struct mm_s
  	if (!is_migration_entry(entry))
  		goto out;
  
 -	page = pfn_swap_entry_to_page(entry);
 -	page = compound_head(page);
 +	folio = page_folio(pfn_swap_entry_to_page(entry));
  
- 	/*
- 	 * Once page cache replacement of page migration started, page_count
- 	 * is zero; but we must not call folio_put_wait_locked() without
- 	 * a ref. Use folio_try_get(), and just fault again if it fails.
- 	 */
- 	if (!folio_try_get(folio))
- 		goto out;
- 	pte_unmap_unlock(ptep, ptl);
- 	folio_put_wait_locked(folio, TASK_UNINTERRUPTIBLE);
 -	migration_entry_wait_on_locked(page_folio(page), ptep, ptl);
++	migration_entry_wait_on_locked(folio, ptep, ptl);
  	return;
  out:
  	pte_unmap_unlock(ptep, ptl);