On Thu, Nov 1, 2018 at 12:57 PM Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote: > > > I think the graceful recovery is to simply return: > > > > if (WARN_ON(cond)) > > return; > > > > is better than just > > > > BUG_ON(cond); > > > > As that's what Linus made pretty clear at the Maintainer's Summit. > > That's it. For an unmap function, this basically boils down to > print a warning and leak the memory on internal unmap error. > > I will update the commit message describing this behavior. It might be even better to use WARN_ON_ONCE(). If it's a "this shouldn't happen" situation, the advantage of WARN_ON_ONCE() is that it will still show the backtrace of the "how the heck did it happen after all" situation, but if it turns ouit to be user-triggerable (or simply triggerable by some odd hw situation), it won't spam your logs forever. Obviously, things like rate limiting etc can also be good ideas, but that's just overkill for "this really should never happen" cases. (Side note: WARN_ON_ONCE() will _warn_ just once, but will always return the condition that it warns for, so the return value is _not_ "I have warned", but "I have seen the condition that I should warn about". Just in case people are worried about it). Linus