mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Lianwei Wang <lianwei.wang@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	linux-pm@lists.linux-foundation.org, rjw@rjwysocki.net,
	mingo@redhat.com
Subject: Re: [PATCH] sched: idle: move need_resched check after function rcu_idle_enter
Date: Mon, 23 Nov 2015 18:59:26 +0100	[thread overview]
Message-ID: <20151123175926.GM17308@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CAJFUiJjCcGriSzOZe7BGNb-crrdY5NdUwiWGAO8zM+L_PDr82w@mail.gmail.com>

On Sat, Nov 21, 2015 at 01:02:02AM -0800, Lianwei Wang wrote:
> 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;

FWIW your patch is whitespace mangled; I could not apply if I wanted to.

      parent reply	other threads:[~2015-11-23 17:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21  9:02 Lianwei Wang
2015-11-23 13:05 ` Peter Zijlstra
2015-11-23 17:42   ` Lianwei Wang
2015-11-23 17:57     ` Peter Zijlstra
2015-11-23 20:02       ` Lianwei Wang
2015-11-23 17:59 ` Peter Zijlstra [this message]

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=20151123175926.GM17308@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=lianwei.wang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mingo@redhat.com \
    --cc=rjw@rjwysocki.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®