Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274615

[PATCH] sched: idle: move need_resched check after function rcu_idle_enter

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Lianwei Wang <lianwei.wang@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] sched: idle: move need_resched check after function rcu_idle_enter
Date Sat, 21 Nov 2015 10:10:01 +0100
Message-ID <qxclb-3eb-1@gated-at.bofh.it> (permalink)
X-Original-To linux-kernel@vger.kernel.org, linux-pm@lists.linux-foundation.org, rjw@rjwysocki.net, mingo@redhat.com, peterz@infradead.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=RVnbSX2mvNGGuE3sLo17rp4gWbp4aOJ5p+0x2eg1+NU=; b=vSFjjWTrUj5H6zbg1VX+UE9zLvhMEIICo1nhkB4u4szCZCWS6WSzM9d3uYpf5JheFF 7V+iS9/6eO4MvZem07jLwezEdjwI+LqiVqrYPSQ379SRVU5bfKi5WrqEGsqFHoAbFk5u Jl9DS6REcWzx6uXasn+gaxKNy9ekA/jSGe+ryIChIzajcogSIE0HIi6GY2EAr25Bs7AG jHroExpUK8WKCxPuMVdyCEGcFvXsTJFaFNRs3dgy5UwPWl7Rb+j7eW5xewfAAQKO0RE9 hQLpeV6cMwau2+rnRZtItlUQWHEDnjbBJSEW1pmIaBnv3zoBqEHEwEgYeYgtTzeJt83P qoWQ==
X-Received by 10.194.188.112 with SMTP id fz16mr21793042wjc.65.1448096541595; Sat, 21 Nov 2015 01:02:21 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 52
Organization linux.* mail to news gateway
X-Original-Date Sat, 21 Nov 2015 01:02:02 -0800
X-Original-Message-ID <CAJFUiJjCcGriSzOZe7BGNb-crrdY5NdUwiWGAO8zM+L_PDr82w@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1274615

Show key headers only | View raw


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@gmail.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] sched: idle: move need_resched check after function rcu_idle_enter Lianwei Wang <lianwei.wang@gmail.com> - 2015-11-21 10:10 +0100
  Re: [PATCH] sched: idle: move need_resched check after function  rcu_idle_enter Peter Zijlstra <peterz@infradead.org> - 2015-11-23 14:10 +0100
    Re: [PATCH] sched: idle: move need_resched check after function rcu_idle_enter Lianwei Wang <lianwei.wang@gmail.com> - 2015-11-23 18:50 +0100
      Re: [PATCH] sched: idle: move need_resched check after function  rcu_idle_enter Peter Zijlstra <peterz@infradead.org> - 2015-11-23 19:00 +0100
        Re: [PATCH] sched: idle: move need_resched check after function rcu_idle_enter Lianwei Wang <lianwei.wang@gmail.com> - 2015-11-23 21:10 +0100
  Re: [PATCH] sched: idle: move need_resched check after function  rcu_idle_enter Peter Zijlstra <peterz@infradead.org> - 2015-11-23 19:00 +0100

csiph-web