diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-03-17 13:18:48 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-03-17 13:18:48 +0000 |
commit | 3d945c7ae401b425bbcb8b2ac6c947b6c044bff6 (patch) | |
tree | 25560fa7812189e474dc74e9af9f30534336e0c3 /sys | |
parent | 5f743a2d8b406a317180efcac6c7c8955ff2a10a (diff) |
Replace curcpu_is_idle() by cpu_is_idle() and use it instead of rolling
our own.
From Michal Mazurek, ok mmcc@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/cpu.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/cpu.c | 6 | ||||
-rw-r--r-- | sys/dev/acpi/acpicpu.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_sched.c | 4 | ||||
-rw-r--r-- | sys/sys/sched.h | 4 |
5 files changed, 13 insertions, 13 deletions
diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index df6c6230589..4cb6f98f654 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.95 2016/02/03 03:25:07 guenther Exp $ */ +/* $OpenBSD: cpu.c,v 1.96 2016/03/17 13:18:47 mpi Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -253,7 +253,7 @@ cpu_idle_mwait_cycle(void) panic("idle with interrupts blocked!"); /* something already queued? */ - if (ci->ci_schedstate.spc_whichqs != 0) + if (!cpu_is_idle(ci)) return; /* @@ -267,7 +267,7 @@ cpu_idle_mwait_cycle(void) * the check in sched_idle() and here. */ atomic_setbits_int(&ci->ci_mwait, MWAIT_IDLING | MWAIT_ONLY); - if (ci->ci_schedstate.spc_whichqs == 0) { + if (cpu_is_idle(ci)) { monitor(&ci->ci_mwait, 0, 0); if ((ci->ci_mwait & MWAIT_IDLING) == MWAIT_IDLING) mwait(0, 0); diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index e88373c3898..e7b434838c5 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.73 2016/03/15 03:17:50 guenther Exp $ */ +/* $OpenBSD: cpu.c,v 1.74 2016/03/17 13:18:47 mpi Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -751,7 +751,7 @@ cpu_idle_mwait_cycle(void) panic("idle with interrupts blocked!"); /* something already queued? */ - if (ci->ci_schedstate.spc_whichqs != 0) + if (!cpu_is_idle(ci)) return; /* @@ -765,7 +765,7 @@ cpu_idle_mwait_cycle(void) * the check in sched_idle() and here. */ atomic_setbits_int(&ci->ci_mwait, MWAIT_IDLING | MWAIT_ONLY); - if (ci->ci_schedstate.spc_whichqs == 0) { + if (cpu_is_idle(ci)) { monitor(&ci->ci_mwait, 0, 0); if ((ci->ci_mwait & MWAIT_IDLING) == MWAIT_IDLING) mwait(0, 0); diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c index 211485622fc..fc8d36a9108 100644 --- a/sys/dev/acpi/acpicpu.c +++ b/sys/dev/acpi/acpicpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpicpu.c,v 1.73 2016/03/14 06:37:31 guenther Exp $ */ +/* $OpenBSD: acpicpu.c,v 1.74 2016/03/17 13:18:47 mpi Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> @@ -1188,7 +1188,7 @@ acpicpu_idle(void) #endif /* something already queued? */ - if (ci->ci_schedstate.spc_whichqs != 0) + if (!cpu_is_idle(ci)) return; /* @@ -1204,7 +1204,7 @@ acpicpu_idle(void) hints = (unsigned)best->address; microuptime(&start); atomic_setbits_int(&ci->ci_mwait, MWAIT_IDLING); - if (ci->ci_schedstate.spc_whichqs == 0) { + if (cpu_is_idle(ci)) { /* intel errata AAI65: cflush before monitor */ if (ci->ci_cflushsz != 0) { membar_sync(); diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index d4ffa25bb24..96b00e5ba5f 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.41 2015/12/23 14:51:17 kettenis Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.42 2016/03/17 13:18:47 mpi Exp $ */ /* * Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org> * @@ -148,7 +148,7 @@ sched_idle(void *v) KASSERT(curproc == spc->spc_idleproc); while (1) { - while (!curcpu_is_idle()) { + while (!cpu_is_idle(curcpu())) { struct proc *dead; SCHED_LOCK(s); diff --git a/sys/sys/sched.h b/sys/sys/sched.h index 376302e8447..e6d5b033d90 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sched.h,v 1.40 2016/03/09 13:38:50 mpi Exp $ */ +/* $OpenBSD: sched.h,v 1.41 2016/03/17 13:18:47 mpi Exp $ */ /* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */ /*- @@ -163,7 +163,7 @@ void sched_start_secondary_cpus(void); void sched_stop_secondary_cpus(void); #endif -#define curcpu_is_idle() (curcpu()->ci_schedstate.spc_whichqs == 0) +#define cpu_is_idle(ci) ((ci)->ci_schedstate.spc_whichqs == 0) void sched_init_runqueues(void); void setrunqueue(struct proc *); |