lkml.org 
[lkml]   [2014]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/6] sched,idle: Clarify where TIF_NRFLAG_POLLING is set
Date
This doesn't change functionality at all, but I've misread this code
so many times that I want to make it a bit more obvious.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
---
kernel/sched/idle.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index 25b9423..2ec9f47 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -67,6 +67,10 @@ void __weak arch_cpu_idle(void)
* cpuidle_idle_call - the main idle function
*
* NOTE: no locks or semaphores should be used here
+ *
+ * On archs that support TIF_POLLING_NRFLAG, is called with polling
+ * set, and it returns with polling set. If it ever stops polling, it
+ * must clear the polling bit.
*/
static void cpuidle_idle_call(void)
{
@@ -178,7 +182,14 @@ exit_idle:
*/
static void cpu_idle_loop(void)
{
+ __current_set_polling();
+
while (1) {
+ /*
+ * Invariant: polling is set here (assuming that the arch
+ * has a polling bit.
+ */
+
tick_nohz_idle_enter();

while (!need_resched()) {
@@ -239,7 +250,6 @@ void cpu_startup_entry(enum cpuhp_state state)
*/
boot_init_stack_canary();
#endif
- __current_set_polling();
arch_cpu_idle_prepare();
cpu_idle_loop();
}
--
1.9.3


\
 
 \ /
  Last update: 2014-06-04 03:01    [W:0.116 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site