lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 22 Jun 2024 15:02:56 +1200
From: Barry Song <21cnbao@...il.com>
To: akpm@...ux-foundation.org
Cc: baolin.wang@...ux.alibaba.com,
	chrisl@...nel.org,
	david@...hat.com,
	linux-kernel@...r.kernel.org,
	linux-mm@...ck.org,
	mhocko@...e.com,
	ryan.roberts@....com,
	shy828301@...il.com,
	surenb@...gle.com,
	v-songbaohua@...o.com,
	willy@...radead.org,
	ying.huang@...el.com,
	yosryahmed@...gle.com,
	yuanshuai@...o.com,
	yuzhao@...gle.com
Subject: Re: [PATCH v2 1/3] mm: extend rmap flags arguments for folio_add_new_anon_rmap

>
> From: Barry Song <v-songbaohua@...o.com>
>
> In the case of a swap-in, a new anonymous folio is not necessarily
> exclusive. This patch updates the rmap flags to allow a new anonymous
> folio to be treated as either exclusive or non-exclusive. To maintain
> the existing behavior, we always use EXCLUSIVE as the default setting.
>
> Suggested-by: David Hildenbrand <david@...hat.com>
> Signed-off-by: Barry Song <v-songbaohua@...o.com>
> Tested-by: Shuai Yuan <yuanshuai@...o.com>
> ---

Hi Andrew,

Could you please help squash the following change (a documentation
enhancement suggested by David) into this patch?

From: Barry Song <v-songbaohua@...o.com>
Date: Sat, 22 Jun 2024 14:51:38 +1200
Subject: [PATCH] mm: enhence doc for extend rmap flags arguments for
 folio_add_new_anon_rmap

Suggested-by: David Hildenbrand <david@...hat.com>
Signed-off-by: Barry Song <v-songbaohua@...o.com>
---
 mm/rmap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index df1a43295c85..9a8d9c848168 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1394,7 +1394,9 @@ void folio_add_anon_rmap_pmd(struct folio *folio, struct page *page,
  *
  * 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.
  */
@@ -1406,6 +1408,7 @@ void folio_add_new_anon_rmap(struct folio *folio, struct vm_area_struct *vma,
 	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);
 	__folio_set_swapbacked(folio);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ