* [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases
@ 2024-03-29 7:37 Barry Song
2024-04-01 14:31 ` Yu Zhao
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Barry Song @ 2024-03-29 7:37 UTC (permalink / raw)
To: akpm, linux-mm
Cc: linux-kernel, Barry Song, Ryan Roberts, Kefeng Wang, John Hubbard,
David Hildenbrand, Alistair Popple, Anshuman Khandual,
Catalin Marinas, David Rientjes, Huang, Ying, Hugh Dickins,
Itaru Kitayama, Kirill A . Shutemov, Luis Chamberlain,
Matthew Wilcox, Vlastimil Babka, Yang Shi, Yin Fengwei, Yu Zhao,
Zi Yan
From: Barry Song <v-songbaohua@oppo.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@arm.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Itaru Kitayama <itaru.kitayama@gmail.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Yin Fengwei <fengwei.yin@intel.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Barry Song <v-songbaohua@oppo.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases
2024-03-29 7:37 [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases Barry Song
@ 2024-04-01 14:31 ` Yu Zhao
2024-04-01 15:20 ` Zi Yan
2024-04-02 7:58 ` Ryan Roberts
2 siblings, 0 replies; 4+ messages in thread
From: Yu Zhao @ 2024-04-01 14:31 UTC (permalink / raw)
To: Barry Song
Cc: akpm, linux-mm, linux-kernel, Barry Song, Ryan Roberts,
Kefeng Wang, John Hubbard, David Hildenbrand, Alistair Popple,
Anshuman Khandual, Catalin Marinas, David Rientjes, Huang, Ying,
Hugh Dickins, Itaru Kitayama, Kirill A . Shutemov,
Luis Chamberlain, Matthew Wilcox, Vlastimil Babka, Yang Shi,
Yin Fengwei, Zi Yan
On Fri, Mar 29, 2024 at 3:38 AM Barry Song <21cnbao@gmail.com> wrote:
>
> From: Barry Song <v-songbaohua@oppo.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.
Acked-by: Yu Zhao <yuzhao@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases
2024-03-29 7:37 [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases Barry Song
2024-04-01 14:31 ` Yu Zhao
@ 2024-04-01 15:20 ` Zi Yan
2024-04-02 7:58 ` Ryan Roberts
2 siblings, 0 replies; 4+ messages in thread
From: Zi Yan @ 2024-04-01 15:20 UTC (permalink / raw)
To: Barry Song
Cc: akpm, linux-mm, linux-kernel, Barry Song, Ryan Roberts,
Kefeng Wang, John Hubbard, David Hildenbrand, Alistair Popple,
Anshuman Khandual, Catalin Marinas, David Rientjes, Huang, Ying,
Hugh Dickins, Itaru Kitayama, Kirill A . Shutemov,
Luis Chamberlain, Matthew Wilcox, Vlastimil Babka, Yang Shi,
Yin Fengwei, Yu Zhao
[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]
On 29 Mar 2024, at 3:37, Barry Song wrote:
> From: Barry Song <v-songbaohua@oppo.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@arm.com>
> Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Alistair Popple <apopple@nvidia.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: "Huang, Ying" <ying.huang@intel.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Itaru Kitayama <itaru.kitayama@gmail.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Yang Shi <shy828301@gmail.com>
> Cc: Yin Fengwei <fengwei.yin@intel.com>
> Cc: Yu Zhao <yuzhao@google.com>
> Cc: Zi Yan <ziy@nvidia.com>
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>
> ---
> mm/memory.c | 3 +++
> 1 file changed, 3 insertions(+)
LGTM. Reviewed-by: Zi Yan <ziy@nvidia.com>
--
Best Regards,
Yan, Zi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases
2024-03-29 7:37 [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases Barry Song
2024-04-01 14:31 ` Yu Zhao
2024-04-01 15:20 ` Zi Yan
@ 2024-04-02 7:58 ` Ryan Roberts
2 siblings, 0 replies; 4+ messages in thread
From: Ryan Roberts @ 2024-04-02 7:58 UTC (permalink / raw)
To: Barry Song, akpm, linux-mm
Cc: linux-kernel, Barry Song, Kefeng Wang, John Hubbard,
David Hildenbrand, Alistair Popple, Anshuman Khandual,
Catalin Marinas, David Rientjes, Huang, Ying, Hugh Dickins,
Itaru Kitayama, Kirill A . Shutemov, Luis Chamberlain,
Matthew Wilcox, Vlastimil Babka, Yang Shi, Yin Fengwei, Yu Zhao,
Zi Yan
On 29/03/2024 07:37, Barry Song wrote:
> From: Barry Song <v-songbaohua@oppo.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@arm.com>
> Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Alistair Popple <apopple@nvidia.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: "Huang, Ying" <ying.huang@intel.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Itaru Kitayama <itaru.kitayama@gmail.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Yang Shi <shy828301@gmail.com>
> Cc: Yin Fengwei <fengwei.yin@intel.com>
> Cc: Yu Zhao <yuzhao@google.com>
> Cc: Zi Yan <ziy@nvidia.com>
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.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) {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-02 7:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-29 7:37 [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases Barry Song
2024-04-01 14:31 ` Yu Zhao
2024-04-01 15:20 ` Zi Yan
2024-04-02 7:58 ` Ryan Roberts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).