On Sun, Aug 14, 2022 at 1:29 PM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > I dug into it some more, and it is really "load_unaligned_zeropad()" > that makes clang really uncomfortable. > > The problem ends up being that clang sees that it's inside that inner > loop, and tries very hard to optimize the shift-and-mask that happens > if the exception happens. > > The fact that the exception *never* happens unless DEBUG_PAGEALLOC is > enabled - and very very seldom even then - is not something we can > really explain to clang. Probably if we could express that the do_exception label in load_unaligned_zeropad was cold then that might help. https://github.com/llvm/llvm-project/issues/46831 Otherwise, could we put the exceptional case statements in a noinline or cold attributed function? -- Thanks, ~Nick Desaulniers