lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 21 Nov 2015 01:02:02 -0800
From:	Lianwei Wang <lianwei.wang@...il.com>
To:	linux-kernel@...r.kernel.org, linux-pm@...ts.linux-foundation.org,
	rjw@...ysocki.net, mingo@...hat.com, peterz@...radead.org
Subject: [PATCH] sched: idle: move need_resched check after function rcu_idle_enter

The rcu_idle_endter may call wakeup_softirqd to set the need resched
flag on idle process. But if we don't check it after that, then the
cpu will enter idle state with RESCHED flag set and can not be woken
up by wakeup/resched call anymore.

Check need_resched after rcu_idle_enter to make sure the cpu is able
to be out of idle immediatley to run other tasks.

Signed-off-by: Lianwei Wang <lianwei.wang@...il.com>
---
 kernel/sched/idle.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index 4a2ef5a02fd3..6e96a1f41041 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -137,21 +137,21 @@ static void cpuidle_idle_call(void)
        int next_state, entered_state;

        /*
+        * Tell the RCU framework we are entering an idle section,
+        * so no more rcu read side critical sections and one more
+        * step to the grace period
+        */
+       rcu_idle_enter();
+
+       /*
         * Check if the idle task must be rescheduled. If it is the
         * case, exit the function after re-enabling the local irq.
         */
        if (need_resched()) {
                local_irq_enable();
-               return;
+               goto exit_idle;
        }

-       /*
-        * Tell the RCU framework we are entering an idle section,
-        * so no more rcu read side critical sections and one more
-        * step to the grace period
-        */
-       rcu_idle_enter();
-
        if (cpuidle_not_available(drv, dev)) {
                default_idle_call();
                goto exit_idle;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists