sched, idle: Fix the idle polling state logic
authorPeter Zijlstra <peterz@infradead.org>
Wed, 11 Sep 2013 10:43:13 +0000 (12:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2013 19:11:42 +0000 (11:11 -0800)
commite895dad0a5b1db5475346d9c2ae4a92e6fefa58d
tree5a1333b355a74c688a911fb2926c127236b55cef
parent5bad04d7bc7fe12a89b716f8b63d32b5735f6dd2
sched, idle: Fix the idle polling state logic

commit ea8117478918a4734586d35ff530721b682425be upstream.

Mike reported that commit 7d1a9417 ("x86: Use generic idle loop")
regressed several workloads and caused excessive reschedule
interrupts.

The patch in question failed to notice that the x86 code had an
inverted sense of the polling state versus the new generic code (x86:
default polling, generic: default !polling).

Fix the two prominent x86 mwait based idle drivers and introduce a few
new generic polling helpers (fixing the wrong smp_mb__after_clear_bit
usage).

Also switch the idle routines to using tif_need_resched() which is an
immediate TIF_NEED_RESCHED test as opposed to need_resched which will
end up being slightly different.

Reported-by: Mike Galbraith <bitbucket@online.de>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: lenb@kernel.org
Cc: tglx@linutronix.de
Link: http://lkml.kernel.org/n/tip-nc03imb0etuefmzybzj7sprf@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/process.c
drivers/acpi/processor_idle.c
drivers/idle/intel_idle.c
include/linux/sched.h
include/linux/thread_info.h
kernel/cpu/idle.c