Tue Apr 21 18:22:29 2020 UTC ()
Follow convention and put entire predicate inside __predict_false()


(ad)
diff -r1.133 -r1.134 src/sys/arch/xen/x86/cpu.c

cvs diff -r1.133 -r1.134 src/sys/arch/xen/x86/cpu.c (expand / switch to unified diff)

--- src/sys/arch/xen/x86/cpu.c 2020/02/24 12:20:29 1.133
+++ src/sys/arch/xen/x86/cpu.c 2020/04/21 18:22:29 1.134
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu.c,v 1.133 2020/02/24 12:20:29 rin Exp $ */ 1/* $NetBSD: cpu.c,v 1.134 2020/04/21 18:22:29 ad Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, 5 * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by RedBack Networks Inc. 9 * by RedBack Networks Inc.
10 * 10 *
11 * Author: Bill Sommerfeld 11 * Author: Bill Sommerfeld
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -55,27 +55,27 @@ @@ -55,27 +55,27 @@
55 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 55 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE 57 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE. 64 * SUCH DAMAGE.
65 */ 65 */
66 66
67#include <sys/cdefs.h> 67#include <sys/cdefs.h>
68__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.133 2020/02/24 12:20:29 rin Exp $"); 68__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.134 2020/04/21 18:22:29 ad Exp $");
69 69
70#include "opt_ddb.h" 70#include "opt_ddb.h"
71#include "opt_multiprocessor.h" 71#include "opt_multiprocessor.h"
72#include "opt_mpbios.h" /* for MPDEBUG */ 72#include "opt_mpbios.h" /* for MPDEBUG */
73#include "opt_mtrr.h" 73#include "opt_mtrr.h"
74#include "opt_xen.h" 74#include "opt_xen.h"
75 75
76#include "lapic.h" 76#include "lapic.h"
77#include "ioapic.h" 77#include "ioapic.h"
78 78
79#include <sys/param.h> 79#include <sys/param.h>
80#include <sys/proc.h> 80#include <sys/proc.h>
81#include <sys/systm.h> 81#include <sys/systm.h>
@@ -1084,27 +1084,27 @@ cpu_get_tsc_freq(struct cpu_info *ci) @@ -1084,27 +1084,27 @@ cpu_get_tsc_freq(struct cpu_info *ci)
1084 else 1084 else
1085 freq = freq >> tinfo->tsc_shift; 1085 freq = freq >> tinfo->tsc_shift;
1086 ci->ci_data.cpu_cc_freq = freq; 1086 ci->ci_data.cpu_cc_freq = freq;
1087} 1087}
1088 1088
1089void 1089void
1090x86_cpu_idle_xen(void) 1090x86_cpu_idle_xen(void)
1091{ 1091{
1092 struct cpu_info *ci = curcpu(); 1092 struct cpu_info *ci = curcpu();
1093  1093
1094 KASSERT(ci->ci_ilevel == IPL_NONE); 1094 KASSERT(ci->ci_ilevel == IPL_NONE);
1095 1095
1096 x86_disable_intr(); 1096 x86_disable_intr();
1097 if (!__predict_false(ci->ci_want_resched)) { 1097 if (__predict_false(!ci->ci_want_resched)) {
1098 idle_block(); 1098 idle_block();
1099 } else { 1099 } else {
1100 x86_enable_intr(); 1100 x86_enable_intr();
1101 } 1101 }
1102} 1102}
1103 1103
1104/* 1104/*
1105 * Loads pmap for the current CPU. 1105 * Loads pmap for the current CPU.
1106 */ 1106 */
1107void 1107void
1108cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap) 1108cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap)
1109{ 1109{
1110 struct cpu_info *ci = curcpu(); 1110 struct cpu_info *ci = curcpu();