On Wed, Mar 17, 2021 at 9:05 PM Ingo Molnar <mi...@kernel.org> wrote: > * Arnd Bergmann <a...@kernel.org> wrote: > > On Wed, Mar 17, 2021 at 9:45 AM Ingo Molnar <mi...@kernel.org> wrote: > > > > > > More importantly, we use this pattern when we don't want !CONFIG_BUG > > > to remove the 'condition'. > > > > > > I.e. the "side effect" here is important scheduler logic. It must > > > never be optimized out. > > > > This behavior for !CONFIG_BUG has changed a while ago, it is now safe > > to rely on the side-effect of the BUG_ON() condition regardless of > > CONFIG_BUG. When that option is disabled, running into the condition > > just ends up in a "do {} while (1)" loop. > > Dunno, I still think it's not a particularly clean pattern to 'hide' > significant side effects within a BUG_ON().
Fair enough. Readability really is the key here, and I agree the current version is easier to understand. The only architectures that even define an optimized BUG_ON() are mips and powerpc, and saving a few cycles is barely worth it in a fast path, which this is clearly not. Arnd