All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	torvalds@linux-foundation.org, peterz@infradead.org,
	luto@amacapital.net, tglx@linutronix.de, rjw@rjwysocki.net,
	daniel.lezcano@linaro.org
Subject: [tip:sched/core] cpuidle: Set polling in poll_idle
Date: Thu, 5 Jun 2014 07:37:07 -0700	[thread overview]
Message-ID: <tip-84c407084137d4e491b07ea5ff8665d19106a5ac@git.kernel.org> (raw)
In-Reply-To: <c65ce49615d338bae8fb79df5daffab19353c900.1401902905.git.luto@amacapital.net>

Commit-ID:  84c407084137d4e491b07ea5ff8665d19106a5ac
Gitweb:     http://git.kernel.org/tip/84c407084137d4e491b07ea5ff8665d19106a5ac
Author:     Andy Lutomirski <luto@amacapital.net>
AuthorDate: Wed, 4 Jun 2014 10:31:14 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 5 Jun 2014 12:09:49 +0200

cpuidle: Set polling in poll_idle

poll_idle is the archetypal polling idle loop; tell the core idle
code about it.

This avoids pointless IPIs when all of the other cpuidle states are
disabled.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: nicolas.pitre@linaro.org
Cc: umgwanakikbuti@gmail.com
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Link: http://lkml.kernel.org/r/c65ce49615d338bae8fb79df5daffab19353c900.1401902905.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/cpuidle/driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 136d6a2..9634f20 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -187,8 +187,11 @@ static int poll_idle(struct cpuidle_device *dev,
 
 	t1 = ktime_get();
 	local_irq_enable();
-	while (!need_resched())
-		cpu_relax();
+	if (!current_set_polling_and_test()) {
+		while (!need_resched())
+			cpu_relax();
+	}
+	current_clr_polling();
 
 	t2 = ktime_get();
 	diff = ktime_to_us(ktime_sub(t2, t1));

  reply	other threads:[~2014-06-05 14:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 17:31 [PATCH v2 0/5] sched: Cleanup and improve polling idle loops Andy Lutomirski
2014-06-04 17:31 ` [PATCH v2 1/5] cpuidle: Set polling in poll_idle Andy Lutomirski
2014-06-05 14:37   ` tip-bot for Andy Lutomirski [this message]
2014-06-04 17:31 ` [PATCH v2 2/5] sched,trace: Add a tracepoint for IPI-less remote wakeups Andy Lutomirski
2014-06-05 14:37   ` [tip:sched/core] sched, trace: " tip-bot for Andy Lutomirski
2014-06-04 17:31 ` [PATCH v2 3/5] sched,idle: Clear polling before descheduling the idle thread Andy Lutomirski
2014-06-04 17:36   ` Peter Zijlstra
2014-06-05 14:37   ` [tip:sched/core] sched/idle: " tip-bot for Andy Lutomirski
2014-06-04 17:31 ` [PATCH v2 4/5] sched,idle: Simplify wake_up_idle_cpu Andy Lutomirski
2014-06-05 14:37   ` [tip:sched/core] sched/idle: Simplify wake_up_idle_cpu() tip-bot for Andy Lutomirski
2014-06-04 17:31 ` [PATCH v2 5/5] sched: Optimize ttwu IPI Andy Lutomirski
2014-06-05 14:37   ` [tip:sched/core] sched/idle: Optimize try-to-wake-up IPI tip-bot for Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-84c407084137d4e491b07ea5ff8665d19106a5ac@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.