Re: [PATCH v2 0/8] Introduce a huge-page pre-zeroing mechanism
From: Gregory Price
Date: Tue Jan 20 2026 - 13:38:41 EST
On Tue, Jan 20, 2026 at 01:18:19PM -0500, Gregory Price wrote:
> This is a trivial example, but it's unclear zero_on_free actually
> provides a benefit. You have to know ahead of time what the runtime
> behavior, pre-zeroed count, and allocation pattern (0->10->5->...) would
> be to determine whether there's an actual reduction in startup time.
>
> But just trivially, starting from the base case of no pages being
> zeroed, you're just injecting an additional zero(X) cost if program_a()
> consumes more hugepages than program_b().
>
> Long way of saying the shift from alloc to free seems heuristic-y and
> you need stronger analysis / better data to show this change is actually
> beneficial in the general case.
>
As an addendum to this: Maybe this is an indication that a global
switch (per-node sysfs entry) is not the best decision, and that maybe
there's a better way to accomplish this with a reduced scope.
hugetlb-only sysfs knob
- same issue as current proposal, but better placed
why would you only apply this on one node?
prctl thingy
- limits effects to just those opting into alloc-on-free
- probably still needs hugetlb-internal zeroed-pages tracking
but doesn't require the rest of the machinery
do it entirely in userland
- modify the software to zero before exit
- use MAP_UNINITIALIZED
- useful and simple if your hugetlb use case is homogenous
there's probably more oprtions
~Gregory