lkml.org 
[lkml]   [2021]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/mmap: replace if (cond) BUG() with BUG_ON()
On Tue, 5 Jan 2021 20:28:27 -0800 (PST) Hugh Dickins <hughd@google.com> wrote:

> Alex, please consider why the authors of these lines (whom you
> did not Cc) chose to write them without BUG_ON(): it has always
> been preferred practice to use BUG_ON() on predicates, but not on
> functionally effective statements (sorry, I've forgotten the proper
> term: I'd say statements with side-effects, but here they are not
> just side-effects: they are their main purpose).
>
> We prefer not to hide those away inside BUG macros

Should we change that? I find BUG_ON(something_which_shouldnt_fail())
to be quite natural and readable.

As are things like the existing

BUG_ON(mmap_read_trylock(mm));
BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL));

etc.


No strong opinion here, but is current mostly-practice really
useful?

\
 
 \ /
  Last update: 2021-01-06 20:48    [W:0.150 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site