[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20e7f812-c1e7-455f-a523-08fc99024adb@arm.com>
Date: Sun, 14 Sep 2025 19:34:13 +0530
From: Dev Jain <dev.jain@....com>
To: Usama Arif <usamaarif642@...il.com>, David Hildenbrand
<david@...hat.com>, linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Zi Yan <ziy@...dia.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>, Nico Pache <npache@...hat.com>,
Ryan Roberts <ryan.roberts@....com>, Barry Song <baohua@...nel.org>
Subject: Re: [PATCH v1] mm/huge_memory: fix shrinking of all-zero THPs with
max_ptes_none default
>> ---
>> mm/huge_memory.c | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>> index 26cedfcd74189..aa3ed7a86435b 100644
>> --- a/mm/huge_memory.c
>> +++ b/mm/huge_memory.c
>> @@ -4110,9 +4110,6 @@ static bool thp_underused(struct folio *folio)
>> void *kaddr;
>> int i;
>>
>> - if (khugepaged_max_ptes_none == HPAGE_PMD_NR - 1)
>> - return false;
>> -
> I do agree with your usecase, but I am really worried about the amount of
> work and cpu time the THP shrinker will consume when max_ptes_none is 511
> (I dont have any numbers to back up my worry :)), and its less likely that
> we will have these completely zeroed out THPs (again no numbers to back up
> this statement). We have the huge_zero_folio as well which is installed on read.
How about just doing a memcmp() between huge_zero_folio and folio? We know
exactly how this folio looks like, in case of max_ptes_none == 511, if it
is to be eligible for shrinking.
>
>> for (i = 0; i < folio_nr_pages(folio); i++) {
>> kaddr = kmap_local_folio(folio, i * PAGE_SIZE);
>> if (!memchr_inv(kaddr, 0, PAGE_SIZE)) {
Powered by blists - more mailing lists