# Re: \[RFC PATCH for 4.21 03/16\] mm: Replace BUG\_ON() by WARN\_ON() in vm\_unmap\_ram()

- From: Mathieu Desnoyers \<mathieu.desnoyers@efficios.com\>
- Date: 2018-11-01 19:57:57 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2018/11/5421529
- Thread: https://ratatoskr.run/linux-api/2018/11/5421087/t.md

```text
----- On Nov 1, 2018, at 7:46 PM, rostedt rostedt@goodmis.org wrote:

> On Thu, 1 Nov 2018 13:21:12 +0100 (CET)
> Thomas Gleixner [ref] wrote:
> 
>> Mathieu,
>> 
>> On Thu, 1 Nov 2018, Mathieu Desnoyers wrote:
>> 
>> > It is encouraged to warn and return rather than use BUG_ON() when
>> > the condition can be recovered from in ways that are more graceful than
>> > halting the whole system.
>> 
>> You're failing to desribe how that graceful recovery works.
>> 
> 
> 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.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
```
