Re:Re: [PATCH] arm64/kernel/probes: Use BUG_ON instead of if condition followed by BUG.

周传高 zhouchuangao at vivo.com
Thu Apr 1 11:49:37 BST 2021


>On Tue, Mar 30, 2021 at 04:57:50AM -0700, zhouchuangao wrote:>> It can be optimized at compile time.
>
>Hmm, I don't see it (and I also don't understand why we care). Do you have
>numbers showing that this is worthwhile?
>

#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)

BUG_ON uses unlikely in if(). Through disassembly, we can see that
brk #0x800 is compiled to the end of the function.
As you can see below:
    ......
    ffffff8008660bec:   d65f03c0    ret
    ffffff8008660bf0:   d4210000    brk #0x800

Usually, the condition in if () is not satisfied. For the multi-stage pipeline, 
we do not need to perform fetch decode and excute operation on brk 
instruction.

In my opinion, this can improve the efficiency of the multi-stage pipeline.

zhouchuangao

>Will




More information about the linux-arm-kernel mailing list