summaryrefslogtreecommitdiffstats
path: root/arch/i386
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-10 23:18:26 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-10 23:18:26 +0000
commitc7c4310f7fc1485925d800628bf50b3aeab535ef (patch)
treeb12aa4be0e8fb82aaaea97fb475e793e8a347c49 /arch/i386
parent1ffd1d069ca4c5ffe16fea6175dab1b9bbb15820 (diff)
Merge with Linux 2.4.0-test3-pre8. Linus has accepted most of what
I've sent him, so we're very close to full integration of the MIPS port into his sources.
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/kernel/entry.S4
-rw-r--r--arch/i386/kernel/process.c40
2 files changed, 41 insertions, 3 deletions
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index a80d61ebc..660a9e1fb 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -77,8 +77,8 @@ sigpending = 8
addr_limit = 12
exec_domain = 16
need_resched = 20
-processor = 56
-tsk_ptrace = 60
+processor = 48
+tsk_ptrace = 56
ENOSYS = 38
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index bddac2a1d..e240cc79a 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -88,12 +88,38 @@ static void default_idle(void)
}
/*
+ * On SMP it's slightly faster (but much more power-consuming!)
+ * to poll the ->need_resched flag instead of waiting for the
+ * cross-CPU IPI to arrive. Use this option with caution.
+ */
+static void poll_idle (void)
+{
+ int oldval;
+
+ __sti();
+
+ /*
+ * Deal with another CPU just having chosen a thread to
+ * run here:
+ */
+ oldval = xchg(&current->need_resched, -1);
+
+ if (!oldval)
+ asm volatile(
+ "2:"
+ "cmpl $-1, %0;"
+ "rep; nop;"
+ "je 2b;"
+ : :"m" (current->need_resched));
+}
+
+/*
* The idle thread. There's no useful work to be
* done, so just try to conserve power and have a
* low exit latency (ie sit in a loop waiting for
* somebody to say that they'd like to reschedule)
*/
-void cpu_idle(void)
+void cpu_idle (void)
{
/* endless idle loop with no priority at all */
init_idle();
@@ -111,6 +137,18 @@ void cpu_idle(void)
}
}
+static int __init idle_setup (char *str)
+{
+ if (!strncmp(str, "poll", 4)) {
+ printk("using polling idle threads.\n");
+ pm_idle = poll_idle;
+ }
+
+ return 1;
+}
+
+__setup("idle=", idle_setup);
+
static long no_idt[2] = {0, 0};
static int reboot_mode = 0;
static int reboot_thru_bios = 0;