Re: [PATCH 0/8] Introduce a huge-page pre-zeroing mechanism
From: Li Zhe
Date: Mon Dec 29 2025 - 07:34:59 EST
On Sun, 28 Dec 2025 13:44:54 -0800, akpm@xxxxxxxxxxxxxxxxxxxx wrote:
> > Fresh hugetlb pages are zeroed out when they are faulted in,
> > just like with all other page types. This can take up a good
> > amount of time for larger page sizes (e.g. around 40
> > milliseconds for a 1G page on a recent AMD-based system).
> >
> > This normally isn't a problem, since hugetlb pages are typically
> > mapped by the application for a long time, and the initial
> > delay when touching them isn't much of an issue.
> >
> > However, there are some use cases where a large number of hugetlb
> > pages are touched when an application (such as a VM backed by these
> > pages) starts. For 256 1G pages and 40ms per page, this would take
> > 10 seconds, a noticeable delay.
>
> Ankur's contiguous page clearing work
> (https://lkml.kernel.org/r/20251215204922.475324-1-ankur.a.arora@xxxxxxxxxx)
> will hopefully result in significant changes to the timing observations
> in your changelogs?
I conducted the experiment on my Skylake machine; below are the 64-GiB
huge-page fault latencies measured with 1-GiB page size.
Without Ankur's optimization:
Total time: 15.989429 seconds
Avg time per 1GB page: 0.249835 seconds
With Ankur's optimization:
Total time: 12.931696 seconds
Avg time per 1GB page: 0.202058 seconds
For comparison, when the same 64 GiB of memory was pre-zeroed in
advance by the pre-zeroing mechanism, the test completed in negligible
time.
I will incorporate these findings into the V2 description.
Thanks,
Zhe