On 9/2/26 04:56, Yeoreum Yun wrote: > The behaviour of pXd_page() will change with generic compile-time folded > page tables by disallowing its use and triggering a compile-time error > when it's used improperly, ensuring that the actual pXd_page() is used > instead. > > To prepare fot that, skip collapse_pud_page() when > CONFIG_X86_DIRECT_GBPAGES is disabled. Nit: this doesn't explain how the change actually fixes anything or what the specific problem being solved is. I think you want to say something along the lines of: collapse_pud_page() uses pud_page() in a way which will soon trigger a compile-time error on configs that have a folded pud. The code which will generate that error is actually unreachable on those configs because 'direct_gbpages' is always 0 there. However, the compiler does not know that because 'direct_gbpages' is a normal integer from a separate compilation unit. Make the compiler aware when most of collapse_pud_page() is unreachable by adding a Kconfig check. This ensures it will not trip the errors when they are introduced. It probably also trims the kernel image down a wee bit too as a side benefit. Maybe I should just merge something like the attached patch. I think it would solve your problem and make things generally cleaner too.