From c7c4310f7fc1485925d800628bf50b3aeab535ef Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 10 Jul 2000 23:18:26 +0000 Subject: 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. --- arch/i386/kernel/entry.S | 4 ++-- arch/i386/kernel/process.c | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 3 deletions(-) (limited to 'arch/i386') 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 @@ -87,13 +87,39 @@ 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(¤t->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; -- cgit v1.2.3