Re: [PATCH v10 08/14] mm: multi-gen LRU: support page table walks

From: Linus Torvalds
Date: Fri Apr 15 2022 - 17:37:40 EST


On Fri, Apr 15, 2022 at 2:32 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> We could create a new MM-developer-only assertion. Might even call it
> MM_BUG_ON(). With compile-time enablement but perhaps not a runtime
> switch.

.. or VM_BUG_ON() could just become a WARN_ON_ONCE().

Which it should be anyway - since the code has to be written to
continue after that BUG_ON() anyway.

There is absolutely _zero_ advantage to killing the machine. If you
want to be notified about "this must not happen", then WARN_ON_ONCE()
is the right thing to use.

BUG_ON() is basically always the wrong thing to do.

Linus