* [PATCH V2] cpuidle: Add missing checks to the exit condition of cpu_idle_poll()
@ 2015-01-21 10:57 Preeti U Murthy
2015-01-22 21:00 ` Thomas Gleixner
2015-02-01 17:53 ` [tip:sched/core] sched/idle: " tip-bot for Preeti U Murthy
0 siblings, 2 replies; 3+ messages in thread
From: Preeti U Murthy @ 2015-01-21 10:57 UTC (permalink / raw)
To: tglx; +Cc: peterz, linuxppc-dev, mingo, linux-kernel
cpu_idle_poll() is entered into when either the cpu_idle_force_poll is set or
tick_check_broadcast_expired() returns true. The exit condition from
cpu_idle_poll() is tif_need_resched().
However this does not take into account scenarios where cpu_idle_force_poll
changes or tick_check_broadcast_expired() returns false, without setting
the resched flag. So a cpu will be caught in cpu_idle_poll() needlessly,
thereby wasting power. Add an explicit check on cpu_idle_force_poll and
tick_check_broadcast_expired() to the exit condition of cpu_idle_poll()
to avoid this.
Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
---
Changes from V1: Modified the Changelog
kernel/sched/idle.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index c47fce7..aaf1c1d 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -47,7 +47,8 @@ static inline int cpu_idle_poll(void)
rcu_idle_enter();
trace_cpu_idle_rcuidle(0, smp_processor_id());
local_irq_enable();
- while (!tif_need_resched())
+ while (!tif_need_resched() &&
+ (cpu_idle_force_poll || tick_check_broadcast_expired()))
cpu_relax();
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
rcu_idle_exit();
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] cpuidle: Add missing checks to the exit condition of cpu_idle_poll()
2015-01-21 10:57 [PATCH V2] cpuidle: Add missing checks to the exit condition of cpu_idle_poll() Preeti U Murthy
@ 2015-01-22 21:00 ` Thomas Gleixner
2015-02-01 17:53 ` [tip:sched/core] sched/idle: " tip-bot for Preeti U Murthy
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2015-01-22 21:00 UTC (permalink / raw)
To: Preeti U Murthy; +Cc: peterz, linuxppc-dev, mingo, linux-kernel
On Wed, 21 Jan 2015, Preeti U Murthy wrote:
> cpu_idle_poll() is entered into when either the cpu_idle_force_poll is set or
> tick_check_broadcast_expired() returns true. The exit condition from
> cpu_idle_poll() is tif_need_resched().
>
> However this does not take into account scenarios where cpu_idle_force_poll
> changes or tick_check_broadcast_expired() returns false, without setting
> the resched flag. So a cpu will be caught in cpu_idle_poll() needlessly,
> thereby wasting power. Add an explicit check on cpu_idle_force_poll and
> tick_check_broadcast_expired() to the exit condition of cpu_idle_poll()
> to avoid this.
>
> Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> Changes from V1: Modified the Changelog
>
> kernel/sched/idle.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> index c47fce7..aaf1c1d 100644
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -47,7 +47,8 @@ static inline int cpu_idle_poll(void)
> rcu_idle_enter();
> trace_cpu_idle_rcuidle(0, smp_processor_id());
> local_irq_enable();
> - while (!tif_need_resched())
> + while (!tif_need_resched() &&
> + (cpu_idle_force_poll || tick_check_broadcast_expired()))
> cpu_relax();
> trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
> rcu_idle_exit();
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:sched/core] sched/idle: Add missing checks to the exit condition of cpu_idle_poll()
2015-01-21 10:57 [PATCH V2] cpuidle: Add missing checks to the exit condition of cpu_idle_poll() Preeti U Murthy
2015-01-22 21:00 ` Thomas Gleixner
@ 2015-02-01 17:53 ` tip-bot for Preeti U Murthy
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Preeti U Murthy @ 2015-02-01 17:53 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, preeti, peterz, mingo, linux-kernel, torvalds, hpa
Commit-ID: ff6f2d29bd31cdfa1ac494a8b26d2af8ba887d59
Gitweb: http://git.kernel.org/tip/ff6f2d29bd31cdfa1ac494a8b26d2af8ba887d59
Author: Preeti U Murthy <preeti@linux.vnet.ibm.com>
AuthorDate: Wed, 21 Jan 2015 16:27:25 +0530
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 30 Jan 2015 19:38:52 +0100
sched/idle: Add missing checks to the exit condition of cpu_idle_poll()
cpu_idle_poll() is entered into when either the cpu_idle_force_poll is set or
tick_check_broadcast_expired() returns true. The exit condition from
cpu_idle_poll() is tif_need_resched().
However this does not take into account scenarios where cpu_idle_force_poll
changes or tick_check_broadcast_expired() returns false, without setting
the resched flag. So a cpu will be caught in cpu_idle_poll() needlessly,
thereby wasting power. Add an explicit check on cpu_idle_force_poll and
tick_check_broadcast_expired() to the exit condition of cpu_idle_poll()
to avoid this.
Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150121105655.15279.59626.stgit@preeti.in.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/idle.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index c47fce7..aaf1c1d 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -47,7 +47,8 @@ static inline int cpu_idle_poll(void)
rcu_idle_enter();
trace_cpu_idle_rcuidle(0, smp_processor_id());
local_irq_enable();
- while (!tif_need_resched())
+ while (!tif_need_resched() &&
+ (cpu_idle_force_poll || tick_check_broadcast_expired()))
cpu_relax();
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
rcu_idle_exit();
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-01 17:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 10:57 [PATCH V2] cpuidle: Add missing checks to the exit condition of cpu_idle_poll() Preeti U Murthy
2015-01-22 21:00 ` Thomas Gleixner
2015-02-01 17:53 ` [tip:sched/core] sched/idle: " tip-bot for Preeti U Murthy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).