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-next>] [day] [month] [year] [list]
Date: Fri, 29 Mar 2024 20:37:50 +1300
From: Barry Song <21cnbao@...il.com>
To: akpm@...ux-foundation.org,
	linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org,
	Barry Song <v-songbaohua@...o.com>,
	Ryan Roberts <ryan.roberts@....com>,
	Kefeng Wang <wangkefeng.wang@...wei.com>,
	John Hubbard <jhubbard@...dia.com>,
	David Hildenbrand <david@...hat.com>,
	Alistair Popple <apopple@...dia.com>,
	Anshuman Khandual <anshuman.khandual@....com>,
	Catalin Marinas <catalin.marinas@....com>,
	David Rientjes <rientjes@...gle.com>,
	"Huang, Ying" <ying.huang@...el.com>,
	Hugh Dickins <hughd@...gle.com>,
	Itaru Kitayama <itaru.kitayama@...il.com>,
	"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
	Luis Chamberlain <mcgrof@...nel.org>,
	Matthew Wilcox <willy@...radead.org>,
	Vlastimil Babka <vbabka@...e.cz>,
	Yang Shi <shy828301@...il.com>,
	Yin Fengwei <fengwei.yin@...el.com>,
	Yu Zhao <yuzhao@...gle.com>,
	Zi Yan <ziy@...dia.com>
Subject: [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases

From: Barry Song <v-songbaohua@...o.com>

Fallback rates surpassing 90% have been observed on phones utilizing 64KiB
CONT-PTE mTHP. In these scenarios, when one out of every 16 PTEs fails
to allocate large folios, the remaining 15 PTEs fallback. Consequently,
invoking vma_thp_gfp_mask seems redundant in such cases. Furthermore,
abstaining from its use can also contribute to improved code readability.

Cc: Ryan Roberts <ryan.roberts@....com>
Cc: Kefeng Wang <wangkefeng.wang@...wei.com>
Cc: John Hubbard <jhubbard@...dia.com>
Cc: David Hildenbrand <david@...hat.com>
Cc: Alistair Popple <apopple@...dia.com>
Cc: Anshuman Khandual <anshuman.khandual@....com>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: David Rientjes <rientjes@...gle.com>
Cc: "Huang, Ying" <ying.huang@...el.com>
Cc: Hugh Dickins <hughd@...gle.com>
Cc: Itaru Kitayama <itaru.kitayama@...il.com>
Cc: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Cc: Luis Chamberlain <mcgrof@...nel.org>
Cc: Matthew Wilcox (Oracle) <willy@...radead.org>
Cc: Vlastimil Babka <vbabka@...e.cz>
Cc: Yang Shi <shy828301@...il.com>
Cc: Yin Fengwei <fengwei.yin@...el.com>
Cc: Yu Zhao <yuzhao@...gle.com>
Cc: Zi Yan <ziy@...dia.com>
Signed-off-by: Barry Song <v-songbaohua@...o.com>
---
 mm/memory.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memory.c b/mm/memory.c
index c9c1031c2ecb..010e7bb20d2b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4353,6 +4353,9 @@ static struct folio *alloc_anon_folio(struct vm_fault *vmf)
 
 	pte_unmap(pte);
 
+	if (!orders)
+		goto fallback;
+
 	/* Try allocating the highest of the remaining orders. */
 	gfp = vma_thp_gfp_mask(vma);
 	while (orders) {
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ