All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Zhaoyang Huang <zhaoyang.huang@linaro.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	zhaoyang.huang@spreadtrum.com,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RESEND PATCH v2 1/2] power/cpuidle: enhance the precision of state select
Date: Sat, 25 Jun 2016 03:09:30 +0200	[thread overview]
Message-ID: <CAJZ5v0jzF6MuA7yQqYuDBCHDfG0cJZ_qtQvfbDL8dNw2XGDL_Q@mail.gmail.com> (raw)
In-Reply-To: <1466154816-17900-1-git-send-email-zhaoyang.huang@spreadtrum.com>

On Fri, Jun 17, 2016 at 11:13 AM, Zhaoyang Huang
<zhaoyang.huang@linaro.org> wrote:
> In previous version, cpu_pm_enter is invoked

By whom?  Not by the core surely?

> after the governor select the state, which cause the executing time of cpu_pm_enter
> is included in the idle time. Moving it before the state selection.
>
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@spreadtrum.com>
> ---
>  kernel/sched/idle.c |   18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> index bd12c6c..929da2e 100644
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -5,6 +5,7 @@
>  #include <linux/cpu.h>
>  #include <linux/cpuidle.h>
>  #include <linux/cpuhotplug.h>
> +#include <linux/cpu_pm.h>
>  #include <linux/tick.h>
>  #include <linux/mm.h>
>  #include <linux/stackprotector.h>
> @@ -130,6 +131,7 @@ static void cpuidle_idle_call(void)
>         struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
>         struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
>         int next_state, entered_state;
> +       int ret;
>
>         /*
>          * Check if the idle task must be rescheduled. If it is the
> @@ -174,12 +176,16 @@ static void cpuidle_idle_call(void)
>                 /*
>                  * Ask the cpuidle framework to choose a convenient idle state.
>                  */
> -               next_state = cpuidle_select(drv, dev);
> -               entered_state = call_cpuidle(drv, dev, next_state);
> -               /*
> -                * Give the governor an opportunity to reflect on the outcome
> -                */
> -               cpuidle_reflect(dev, entered_state);
> +               ret = cpu_pm_enter();

"To move" usually means "take it away from there and put it here" as
far as kernel patches are concerned, but I only see it added here.

> +               if (!ret) {
> +                       next_state = cpuidle_select(drv, dev);
> +                       entered_state = call_cpuidle(drv, dev, next_state);
> +                       cpu_pm_exit();
> +                       /*
> +                        * Give the governor an opportunity to reflect on the outcome
> +                        */
> +                       cpuidle_reflect(dev, entered_state);
> +               }
>         }
>
>  exit_idle:
> --

No way I will agree to add that notification stuff to the core.

Thanks,
Rafael

  parent reply	other threads:[~2016-06-25  1:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17  9:13 [RESEND PATCH v2 1/2] power/cpuidle: enhance the precision of state select Zhaoyang Huang
2016-06-17  9:13 ` [RESEND PATCH v2 2/2] power/idle: enhance the precision of sleep_length Zhaoyang Huang
2016-06-17  9:27   ` Thomas Gleixner
2016-06-17 11:18     ` Zhaoyang Huang
2016-06-17 11:50       ` Thomas Gleixner
2016-06-20  1:14         ` Zhaoyang Huang
2016-06-22  3:01           ` Zhaoyang Huang
2016-06-23  7:01             ` Thomas Gleixner
2016-06-23  7:26               ` Zhaoyang Huang
2016-06-23  8:18                 ` Thomas Gleixner
2016-06-23  8:34                   ` Zhaoyang Huang
2016-06-23  8:35                     ` Thomas Gleixner
2016-06-23  8:45                       ` Zhaoyang Huang
2016-06-23 10:16                         ` Thomas Gleixner
2016-06-25  1:09 ` Rafael J. Wysocki [this message]
2016-06-27  1:13   ` [RESEND PATCH v2 1/2] power/cpuidle: enhance the precision of state select Zhaoyang Huang

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=CAJZ5v0jzF6MuA7yQqYuDBCHDfG0cJZ_qtQvfbDL8dNw2XGDL_Q@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=zhaoyang.huang@linaro.org \
    --cc=zhaoyang.huang@spreadtrum.com \
    /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.