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] [day] [month] [year] [list]
Message-ID: <fb322901-28d6-4f0f-8bc0-bcce165ca250@redhat.com>
Date: Mon, 15 Sep 2025 10:51:48 +0200
From: David Hildenbrand <david@...hat.com>
To: Dev Jain <dev.jain@....com>, Usama Arif <usamaarif642@...il.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

On 14.09.25 16:04, Dev Jain wrote:
>>> ---
>>>    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.
> 

FWIW, I am still hesitant on this patch because I think the whole 
deferred split lists + interaction with the shrinker should be cleaned 
up along this patch.

> 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.

I wouldn't really want to optimize for this case, especially given that

(a) I want to remove all direct dependencies on max_ptes_none and any 
special values.

(b) The huge zero folio is not always around

(c) The kmap local prevents us from doing that (in particular on 32bit).


-- 
Cheers

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ