Skip to content

Commit

Permalink
mips/kvm: Use BUG_ON instead of if condition followed by BUG
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zhouchuangao authored and Thomas Bogendoerfer committed Jun 21, 2021
1 parent f9cd46a commit a2cdc24
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/mips/kvm/tlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit a2cdc24

Please sign in to comment.