On Fri, 05 Jun 2026 20:34:49 +0200, Pratyush Yadav <[email protected]> wrote: > Gigantic huge page allocation is somewhat broken currently when KHO is > used. > > Firstly, they break KHO scratch size accounting. RSRV_KERN is used to > track how much memory is reserved for use by the kernel. Since > alloc_bootmem() calls the memblock_alloc*() APIs, the hugepages
hugetlb::alloc_bootmem() > [...] > First, it does not use mirrored memory for hugetlb. Mirrored memory is a > limited resource that is best saved for kernel data structures, not user > memory. > > Second, if the memory found overlaps with KHO scratch areas, it discards > the memory and retries. This sentence is somewhat hard to parse. > > > diff --git a/mm/memblock.c b/mm/memblock.c > index 6349c48154f4..131e54dd5d8d 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -1756,6 +1761,69 @@ void * __init memblock_alloc_try_nid_raw( > [ ... skip 51 lines ... ] > + if (memblock_bottom_up()) > + start = addr + size; > + else > + start = addr - size; > + > + goto retry; Hmm, two goto retry don't seem nice :/ Although I can't see how to imporove it really. Maybe add a helper for going the node fallback? -- Sincerely yours, Mike.
