summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-06-24 21:31:57 +0000
committerpeter <peter@FreeBSD.org>2002-06-24 21:31:57 +0000
commitca21d675fc5f1a22da00120b055eec5dd50de069 (patch)
treeca29d2e370241ce59d05a613e29b68cdba51dbe9 /sys
parentad5da019260f723e87dcd9cc6e9703147ec70d4b (diff)
downloadFreeBSD-src-ca21d675fc5f1a22da00120b055eec5dd50de069.zip
FreeBSD-src-ca21d675fc5f1a22da00120b055eec5dd50de069.tar.gz
Compile in the cpu halt code even on SMP, instead just default the
sysctl (machdep.cpu_idle_hlt) to off in the SMP case. This allows you to turn it on if you wish and do not particularly care about the small window where a cpu will remain halted even when a job is placed on the run queue (until the next clock tick).
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/machdep.c6
-rw-r--r--sys/i386/i386/machdep.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 2ec8d1c..2f11ee2 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -780,7 +780,11 @@ cpu_halt(void)
* the !SMP case, as there is no clean way to ensure that a CPU will be
* woken when there is work available for it.
*/
+#ifdef SMP
+static int cpu_idle_hlt = 0;
+#else
static int cpu_idle_hlt = 1;
+#endif
SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
&cpu_idle_hlt, 0, "Idle loop HLT enable");
@@ -793,7 +797,6 @@ SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
void
cpu_idle(void)
{
-#ifndef SMP
if (cpu_idle_hlt) {
disable_intr();
if (procrunnable()) {
@@ -807,7 +810,6 @@ cpu_idle(void)
__asm __volatile("sti; hlt");
}
}
-#endif
}
/*
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 2ec8d1c..2f11ee2 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -780,7 +780,11 @@ cpu_halt(void)
* the !SMP case, as there is no clean way to ensure that a CPU will be
* woken when there is work available for it.
*/
+#ifdef SMP
+static int cpu_idle_hlt = 0;
+#else
static int cpu_idle_hlt = 1;
+#endif
SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
&cpu_idle_hlt, 0, "Idle loop HLT enable");
@@ -793,7 +797,6 @@ SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
void
cpu_idle(void)
{
-#ifndef SMP
if (cpu_idle_hlt) {
disable_intr();
if (procrunnable()) {
@@ -807,7 +810,6 @@ cpu_idle(void)
__asm __volatile("sti; hlt");
}
}
-#endif
}
/*
OpenPOWER on IntegriCloud