lkml.org 
[lkml]   [2003]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: BUGed to death
Date
On Tuesday 15 April 2003 16:35, Martin J. Bligh wrote:
> >> Seems all these bug checks are fairly expensive. I can get 1%
> >> back on system time for kernel compiles by changing BUG to
> >> "do {} while (0)" to make them all compile away. Profiles aren't
> >> very revealing though ... seems to be within experimental error ;-(
> >
> > What happens if you just turn BUG_ON into "do {} while (0)"?
>
> I believe I already did that by turning BUG() into a null expression.
>
> #define BUG_ON(condition)
> do { if (unlikely((condition)!=0)) BUG(); } while(0)
>
> The compiler should be smart enough to optimise that away, methinks.

No, I meant what happens if BUG() is non-trivial and BUG_ON is a no-op.
I thought it might give an indication of whether time was being lost
evaluating the condition (occurs with BUG and BUG_ON), or mispredicting
the branch (only occurs with BUG).

Duncan.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.276 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site