public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
* linux-next: manual merge of the random tree with the mm-stable tree
@ 2024-07-02  6:40 Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2024-07-02  6:40 UTC (permalink / raw)
  To: Theodore Ts'o, Jason A. Donenfeld, Andrew Morton
  Cc: Barry Song, Barry Song, Hugh Dickins, Lance Yang,
	Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 3069 bytes --]

Hi all,

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

  mm/rmap.c

between commits:

  a2a1b9f670f3 ("mm/rmap: remove duplicated exit code in pagewalk loop")
  92493c3b92b1 ("mm: extend rmap flags arguments for folio_add_new_anon_rmap")
  db4fb1039a19 ("mm: use folio_add_new_anon_rmap() if folio_test_anon(folio)==false")

from the mm-stable tree and commit:

  e788371a45ac ("mm: add VM_DROPPABLE for designating always lazily freeable mappings")

from the random 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/rmap.c
index 8616308610b9,d873a3f06506..000000000000
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@@ -1394,27 -1384,22 +1394,27 @@@ void folio_add_anon_rmap_pmd(struct fol
   *
   * Like folio_add_anon_rmap_*() but must only be called on *new* folios.
   * This means the inc-and-test can be bypassed.
 - * The folio does not have to be locked.
 + * The folio doesn't necessarily need to be locked while it's exclusive
 + * unless two threads map it concurrently. However, the folio must be
 + * locked if it's shared.
   *
 - * If the folio is pmd-mappable, it is accounted as a THP.  As the folio
 - * is new, it's assumed to be mapped exclusively by a single process.
 + * If the folio is pmd-mappable, it is accounted as a THP.
   */
  void folio_add_new_anon_rmap(struct folio *folio, struct vm_area_struct *vma,
 -		unsigned long address)
 +		unsigned long address, rmap_t flags)
  {
 -	int nr = folio_nr_pages(folio);
 +	const int nr = folio_nr_pages(folio);
 +	const bool exclusive = flags & RMAP_EXCLUSIVE;
 +	int nr_pmdmapped = 0;
  
  	VM_WARN_ON_FOLIO(folio_test_hugetlb(folio), folio);
 +	VM_WARN_ON_FOLIO(!exclusive && !folio_test_locked(folio), folio);
  	VM_BUG_ON_VMA(address < vma->vm_start ||
  			address + (nr << PAGE_SHIFT) > vma->vm_end, vma);
 -	if (!(vma->vm_flags & VM_DROPPABLE))
 +
- 	if (!folio_test_swapbacked(folio))
++	if (!folio_test_swapbacked(folio) && !(vma->vm_flags & VM_DROPPABLE))
  		__folio_set_swapbacked(folio);
 -	__folio_set_anon(folio, vma, address, true);
 +	__folio_set_anon(folio, vma, address, exclusive);
  
  	if (likely(!folio_test_large(folio))) {
  		/* increment count (starts at -1) */
@@@ -1858,8 -1852,11 +1858,9 @@@ static bool try_to_unmap_one(struct fol
  				 * discarded. Remap the page to page table.
  				 */
  				set_pte_at(mm, address, pvmw.pte, pteval);
- 				folio_set_swapbacked(folio);
+ 				if (!(vma->vm_flags & VM_DROPPABLE))
+ 					folio_set_swapbacked(folio);
 -				ret = false;
 -				page_vma_mapped_walk_done(&pvmw);
 -				break;
 +				goto walk_abort;
  			}
  
  			if (swap_duplicate(entry) < 0) {

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread
* linux-next: manual merge of the random tree with the mm-stable tree
@ 2024-07-09  7:40 Stephen Rothwell
  2024-07-23 23:15 ` Stephen Rothwell
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2024-07-09  7:40 UTC (permalink / raw)
  To: Theodore Ts'o, Jason A. Donenfeld, Andrew Morton
  Cc: Barry Song, Barry Song, Lance Yang, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 3222 bytes --]

Hi all,

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

  mm/rmap.c

between commits:

  26d21b18d971 ("mm/rmap: remove duplicated exit code in pagewalk loop")
  15bde4abab73 ("mm: extend rmap flags arguments for folio_add_new_anon_rmap")

from the mm-stable tree and commit:

  94beef29e110 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")

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

-- 
Cheers,
Stephen Rothwell

diff --cc mm/rmap.c
index 8616308610b9,1f9b5a9cb121..000000000000
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@@ -1394,27 -1384,26 +1394,30 @@@ void folio_add_anon_rmap_pmd(struct fol
   *
   * Like folio_add_anon_rmap_*() but must only be called on *new* folios.
   * This means the inc-and-test can be bypassed.
 - * The folio does not have to be locked.
 + * The folio doesn't necessarily need to be locked while it's exclusive
 + * unless two threads map it concurrently. However, the folio must be
 + * locked if it's shared.
   *
 - * If the folio is pmd-mappable, it is accounted as a THP.  As the folio
 - * is new, it's assumed to be mapped exclusively by a single process.
 + * If the folio is pmd-mappable, it is accounted as a THP.
   */
  void folio_add_new_anon_rmap(struct folio *folio, struct vm_area_struct *vma,
 -		unsigned long address)
 +		unsigned long address, rmap_t flags)
  {
 -	int nr = folio_nr_pages(folio);
 +	const int nr = folio_nr_pages(folio);
 +	const bool exclusive = flags & RMAP_EXCLUSIVE;
 +	int nr_pmdmapped = 0;
  
  	VM_WARN_ON_FOLIO(folio_test_hugetlb(folio), folio);
 +	VM_WARN_ON_FOLIO(!exclusive && !folio_test_locked(folio), folio);
  	VM_BUG_ON_VMA(address < vma->vm_start ||
  			address + (nr << PAGE_SHIFT) > vma->vm_end, vma);
- 
- 	if (!folio_test_swapbacked(folio))
+ 	/*
+ 	 * VM_DROPPABLE mappings don't swap; instead they're just dropped when
+ 	 * under memory pressure.
+ 	 */
 -	if (!(vma->vm_flags & VM_DROPPABLE))
++	if (!folio_test_swapbacked(folio) && !(vma->vm_flags & VM_DROPPABLE))
  		__folio_set_swapbacked(folio);
 -	__folio_set_anon(folio, vma, address, true);
 +	__folio_set_anon(folio, vma, address, exclusive);
  
  	if (likely(!folio_test_large(folio))) {
  		/* increment count (starts at -1) */
@@@ -1858,8 -1862,15 +1867,13 @@@ static bool try_to_unmap_one(struct fol
  				 * discarded. Remap the page to page table.
  				 */
  				set_pte_at(mm, address, pvmw.pte, pteval);
- 				folio_set_swapbacked(folio);
+ 				/*
+ 				 * Unlike MADV_FREE mappings, VM_DROPPABLE ones
+ 				 * never get swap backed on failure to drop.
+ 				 */
+ 				if (!(vma->vm_flags & VM_DROPPABLE))
+ 					folio_set_swapbacked(folio);
 -				ret = false;
 -				page_vma_mapped_walk_done(&pvmw);
 -				break;
 +				goto walk_abort;
  			}
  
  			if (swap_duplicate(entry) < 0) {

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread
* linux-next: manual merge of the random tree with the mm-stable tree
@ 2024-07-09  7:43 Stephen Rothwell
  2024-07-23 23:16 ` Stephen Rothwell
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2024-07-09  7:43 UTC (permalink / raw)
  To: Theodore Ts'o, Jason A. Donenfeld, Andrew Morton
  Cc: Donet Tom, Linux Kernel Mailing List, Linux Next Mailing List,
	Ritesh Harjani (IBM)

[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]

Hi all,

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

  tools/testing/selftests/mm/Makefile

between commit:

  3a103b5315b7 ("selftest: mm: Test if hugepage does not get leaked during __bio_release_pages()")

from the mm-stable tree and commit:

  94beef29e110 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")

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

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/selftests/mm/Makefile
index e1aa09ddaa3d,e3e5740e13e1..000000000000
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@@ -75,7 -73,7 +75,8 @@@ TEST_GEN_FILES += ksm_functional_test
  TEST_GEN_FILES += mdwe_test
  TEST_GEN_FILES += hugetlb_fault_after_madv
  TEST_GEN_FILES += hugetlb_madv_vs_map
 +TEST_GEN_FILES += hugetlb_dio
+ TEST_GEN_FILES += droppable
  
  ifneq ($(ARCH),arm64)
  TEST_GEN_FILES += soft-dirty

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-24  1:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02  6:40 linux-next: manual merge of the random tree with the mm-stable tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2024-07-09  7:40 Stephen Rothwell
2024-07-23 23:15 ` Stephen Rothwell
2024-07-24  1:34   ` Jason A. Donenfeld
2024-07-09  7:43 Stephen Rothwell
2024-07-23 23:16 ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox