Re: Bisected: [PATCH v7 2/8] hugetlb: restructure pool allocations

From: Sergey Senozhatsky
Date: Wed Oct 18 2023 - 22:15:43 EST


On (23/10/18 15:44), Mike Kravetz wrote:
> Hi Sergey,
>
> Sorry for the delay. Not ignoring your report but chasing this in
> another thread.

Hi Mike, no worries.

> https://lore.kernel.org/linux-mm/20231018222003.GA21776@monkey/

Oh, interesting.
I just read the article the other day about some of unexpected optimizations
that clang can do [1].

Setting h to NULL seems to be fixing the problem for me.

> Quick question.
> Are you using LLVM/clang in your builds?

Yes, clang 14.0.6
The kernel compiled with gcc does not BUG_ON().

> My guess is that you are hitting the same issue. That BUG at mm/hugetlb.c:3180
> should not be checked/executed unless you allocate gigantic hugetlb pages on
> the kernel command line. Suspect you are not doing this, and loop code is
> being run when it should not.

Looks very similar indeed.

[1] https://research.swtch.com/ub