linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] cpuidle: Select polling interval based on a c-state with a longer target residency
Date: Tue, 1 Dec 2020 15:22:24 +0000	[thread overview]
Message-ID: <20201201152224.GU3371@techsingularity.net> (raw)
In-Reply-To: <CAJZ5v0gMyMhjmFwV=j2+iu21K+upvrt0m_d-b5nFE5EfccNHjg@mail.gmail.com>

On Tue, Dec 01, 2020 at 04:08:02PM +0100, Rafael J. Wysocki wrote:
> > > Also this is about certain drivers only which support the "polling
> > > idle state" (the ACPI one and intel_idle only AFAICS).  So I'm not
> > > sure about the framework-level tunable here.
> > >
> > > Moreover, to be precise, that value is the maximum time to do the
> > > polling (in one go) in the case when requesting any "physical" idle
> > > states is likely to hurt energy-efficiency or latency.  In particular,
> > > it doesn't mean that idle CPUs will do the idle polling every time.
> > >
> >
> > At first I was nodding along and thinking "sure". Then I started
> > thinking about what the configuration space then looks like and how a
> > user might reasonably interpret it. You were right during the review of
> > the first version, it's a mess because it's driver specific and difficult
> > to interpret even on a per-driver basis because there is no control of
> > when a rescheduling event may occur.
> 
> Indeed.
> 
> > You suggest making poll=0 would be valid but that might be interpreted
> > as being equivalent to idle=poll on x86 which is not the same thing.
> > processor_idle and intel_idle would have understandable semantics if the
> > parameter was maxpoll but it's not as understandable for haltpoll.
> 
> Well, my point was basically that if the plan was to add a boot
> parameter to control the polling behavior, it would be prudent to also
> allow the admin to specify that they didn't want any polling at all.
> 
> But frankly I was hoping to drive you away from that idea which seems
> to have worked. :-)
> 

Yes, it most certainly worked. Thanks for repeating yourself in a different
way so that your concern could penetrate my thick skull :D

> > Finally, the parameter partially ties us into the current
> > implementation. For example, the polling loop is based on clock time but
> > we know looking up the clock is costly in itself so it's very granular
> > based on the magic "check every 200 loops" logic meaning we can go over
> > the expected maxiumum polling inverval. If we ever changed that into a
> > calibration loop to estimate the number of loops then the polling interval
> > changes slightly even for the same parameter as we no longer depend on the
> > granularity of calling local_clock. If we ever decided to use adaptive
> > polling similar to haltpoll then the behaviour changes again resulting
> > in bugs because the driver.poll parameter means something new.
> 
> Right.
> 
> > Using min_cstate was definitely a hazard because it showed up in both
> > microbenchmarks and real workloads but you were right, lets only
> > introduce a tunable when and if there is no other choice in the matter.
> >
> > So, informally the following patch is the next candidate. I'm happy to
> > resend it as a separate mail if you prefer and think the patch is ok.
> 
> I actually can apply it right away, so no need to resend.
> 

Thanks very much.

-- 
Mel Gorman
SUSE Labs

  reply	other threads:[~2020-12-01 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  9:22 [PATCH] cpuidle: Select polling interval based on a c-state with a longer target residency Mel Gorman
2020-11-30 19:06 ` Rafael J. Wysocki
2020-11-30 22:32   ` Mel Gorman
2020-12-01 15:08     ` Rafael J. Wysocki
2020-12-01 15:22       ` Mel Gorman [this message]
2020-12-14 14:54 ` [cpuidle] cbf796d1ec: will-it-scale.per_thread_ops 30.5% improvement kernel test robot

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=20201201152224.GU3371@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=rafael@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).