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]
Message-ID: <7d1c8c0a-1eb3-4919-9834-9b705c2ae7c8@redhat.com>
Date: Wed, 25 Jun 2025 12:29:04 +0200
From: David Hildenbrand <david@...hat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Baolin Wang <baolin.wang@...ux.alibaba.com>,
 Hugh Dickins <hughd@...gle.com>, akpm@...ux-foundation.org, ziy@...dia.com,
 Liam.Howlett@...cle.com, npache@...hat.com, ryan.roberts@....com,
 dev.jain@....com, baohua@...nel.org, zokeefe@...gle.com,
 shy828301@...il.com, usamaarif642@...il.com, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 0/2] fix MADV_COLLAPSE issue if THP settings are
 disabled

On 25.06.25 12:15, Lorenzo Stoakes wrote:
> On Wed, Jun 25, 2025 at 12:07:12PM +0200, David Hildenbrand wrote:
>>> Yes, I don't mean it will prevent madvise_collapse(), just as you said
>>> that it could be problematic (it's horrible to try to collapse 512MB).
>>
>> Well, assume you have a VM at that is 2 GiB and could use 4 THPs. It's
>> stupid, but there might be some selected use cases where it's not completely
>> stupid.
> 
> I guess we limit the stupidity by MADV_COLLAPSE working on a PMD-aligned range
> so it'll be a no-op for an attempt to collapse 2 MiB (unless I'm misreading the
> code).

At least the doc says: "MADV_COLLAPSE will automatically clamp the 
provided range to be hugepage-aligned.", and skimming over the code that 
seems to be the case.

Which makes sense to me: never collapse outside the provided range.

So if someone would ever specify something smaller (e.g., 2MiB aligned 
range with 512MiB PMD size) we could decide to collapse a 2MiB THP there 
instead. Right now, it would be ignored.

Guess the rule is simply to not collapse outside of the requested range. 
Maybe that rule can be used to support collapsing of smaller THPs in the 
future as well. Maybe  (can of worms) :)

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ