From: zhouchuangao Date: Fri, 23 Apr 2021 08:35:09 +0000 (-0700) Subject: mips/kvm: Use BUG_ON instead of if condition followed by BUG X-Git-Tag: howlett/maple/20220722_2~2855^2~9 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a2cdc24e20573cf719f3171071368f4f7781d970;p=users%2Fjedix%2Flinux-maple.git mips/kvm: Use BUG_ON instead of if condition followed by BUG 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 Signed-off-by: Thomas Bogendoerfer --- diff --git a/arch/mips/kvm/tlb.c b/arch/mips/kvm/tlb.c index 1088114e5482..a3b50d5e3b25 100644 --- a/arch/mips/kvm/tlb.c +++ b/arch/mips/kvm/tlb.c @@ -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));