OSDN Git Service

mips/kvm: Use BUG_ON instead of if condition followed by BUG
authorzhouchuangao <zhouchuangao@vivo.com>
Fri, 23 Apr 2021 08:35:09 +0000 (01:35 -0700)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Mon, 21 Jun 2021 09:40:54 +0000 (11:40 +0200)
BUG_ON uses unlikely in if(), it can be optimized at compile time.

Usually, the condition in if() is not satisfied. In my opinion,
this can improve the efficiency of the multi-stage pipeline.

Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/kvm/tlb.c

index 1088114..a3b50d5 100644 (file)
@@ -58,8 +58,7 @@ static int _kvm_mips_host_tlb_inv(unsigned long entryhi)
        tlb_probe_hazard();
        idx = read_c0_index();
 
-       if (idx >= current_cpu_data.tlbsize)
-               BUG();
+       BUG_ON(idx >= current_cpu_data.tlbsize);
 
        if (idx >= 0) {
                write_c0_entryhi(UNIQUE_ENTRYHI(idx));