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: <f4d0e176-b1d4-47f0-be76-4bff3dd7339a@redhat.com>
Date: Wed, 8 Oct 2025 16:44:22 +0200
From: David Hildenbrand <david@...hat.com>
To: Gregory Price <gourry@...rry.net>
Cc: linux-mm@...ck.org, corbet@....net, muchun.song@...ux.dev,
 osalvador@...e.de, akpm@...ux-foundation.org, hannes@...xchg.org,
 laoar.shao@...il.com, brauner@...nel.org, mclapinski@...gle.com,
 joel.granados@...nel.org, linux-doc@...r.kernel.org,
 linux-kernel@...r.kernel.org, Mel Gorman <mgorman@...e.de>,
 Michal Hocko <mhocko@...e.com>,
 Alexandru Moise <00moses.alexander00@...il.com>,
 David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH] Revert "mm, hugetlb: remove hugepages_treat_as_movable
 sysctl"

On 08.10.25 16:18, Gregory Price wrote:
> On Wed, Oct 08, 2025 at 10:58:23AM +0200, David Hildenbrand wrote:
>> On 07.10.25 23:44, Gregory Price wrote:
>> I mean, this is as ugly as it gets.
>>
>> Can't we just let that old approach RIP where it belongs? :)
>>
> 
> Definitely - just found this previously existed and wanted to probe for
> how offensive reintroducing it would be. Seems the answer is essentially
> "lets do it a little differently".
> 
>> Something I could sympathize is is treaing gigantic pages that are actually
>> migratable as movable.
>>
> ...
>> -       gfp |= hugepage_movable_supported(h) ? GFP_HIGHUSER_MOVABLE : GFP_HIGHUSER;
>> +       gfp |= hugepage_migration_supported(h) ? GFP_HIGHUSER_MOVABLE : GFP_HIGHUSER;
>>
>> Assume you want to offline part of the ZONE_MOVABLE there might still be sufficient
>> space to possibly allocate a 1 GiB area elsewhere and actually move the gigantic page.
>>
>> IIRC, we do the same for memory offlining already.
>>
> 
> This is generally true of other page sizes as well, though, isn't it?
> If the system is truly so pressured that it can't successfully move a
> 2MB page - offline may still fail.  So allowing 1GB pages is only a risk
> in the sense that they're harder to allocate new targets.

Right, but memory defragmentation works on pageblock level, so 2 MiB is 
much MUCH more reliable :)

> 
> It matters more if your system has 64GB than it does if it has 4TB.
> 
>> Now, maybe we want to make the configurable. But then, I would much rather tweak the
>> hstate_is_gigantic() check in hugepage_movable_supported(). And the parameter
>> would need a much better name than some "treat as movable".
>>
> 
> Makes sense - I think the change is logically equivalent.
> 
> So it would look like...
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 42f374e828a2..36b1eec58e6f 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -924,7 +924,7 @@ static inline bool hugepage_movable_supported(struct hstate *h)
>          if (!hugepage_migration_supported(h))
>                  return false;
> 
> -       if (hstate_is_gigantic(h))
> +       if (hstate_is_gigantic(h) && !movable_gigantic_pages)
>                  return false;
>          return true;
>   }
> 
> And adjust documentation accordingly.
> 
> I'm running some tests in QEMU atm, but it's taking a bit.  Will report
> back if I see issues with migration when this is turned on.
> 
> If that's acceptable, I'll hack this up.

That looks better to me indeed.

Maybe we can export this toggle only if the arch supports migration? 
Then there is also nothing odd to document.

-- 
Cheers

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ