From: Marcelo Tosatti <mtosatti@redhat.com>
To: Parshuram Sangle <parshuram.sangle@intel.com>
Cc: rafael@kernel.org, daniel.lezcano@linaro.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
jaishankar.rajendran@intel.com
Subject: Re: [PATCH] cpuidle: do not shrink guest poll_limit_ns below grow_start
Date: Thu, 1 Feb 2024 15:45:01 -0300 [thread overview]
Message-ID: <ZbvmrdBkeOK71KGg@tpad> (raw)
In-Reply-To: <20240111135950.17016-1-parshuram.sangle@intel.com>
On Thu, Jan 11, 2024 at 07:29:50PM +0530, Parshuram Sangle wrote:
> While adjusting guest halt poll limit, grow block starts at
> guest_halt_poll_grow_start without taking intermediate values.
> Similar behavior is expected while shrinking the value. This
> avoids short interval values which are really not required.
>
> VCPU1 trace (guest_halt_poll_shrink equals 2):
>
> VCPU1 grow 10000
> VCPU1 shrink 5000
> VCPU1 shrink 2500
> VCPU1 shrink 1250
> VCPU1 shrink 625
> VCPU1 shrink 312
> VCPU1 shrink 156
> VCPU1 shrink 78
> VCPU1 shrink 39
> VCPU1 shrink 19
> VCPU1 shrink 9
> VCPU1 shrink 4
>
> Similar change is done in KVM halt poll flow with below patch:
> Link: https://lore.kernel.org/kvm/20211006133021.271905-3-sashal@kernel.org/
>
> Co-developed-by: Rajendran Jaishankar <jaishankar.rajendran@intel.com>
> Signed-off-by: Rajendran Jaishankar <jaishankar.rajendran@intel.com>
> Signed-off-by: Parshuram Sangle <parshuram.sangle@intel.com>
> ---
> drivers/cpuidle/governors/haltpoll.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/haltpoll.c b/drivers/cpuidle/governors/haltpoll.c
> index 1dff3a52917d..663b7f164d20 100644
> --- a/drivers/cpuidle/governors/haltpoll.c
> +++ b/drivers/cpuidle/governors/haltpoll.c
> @@ -98,10 +98,15 @@ static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns)
> unsigned int shrink = guest_halt_poll_shrink;
>
> val = dev->poll_limit_ns;
> - if (shrink == 0)
> + if (shrink == 0) {
> val = 0;
> - else
> + } else {
> val /= shrink;
> + /* Reset value to 0 if shrunk below grow_start */
> + if (val < guest_halt_poll_grow_start)
> + val = 0;
> + }
> +
> trace_guest_halt_poll_ns_shrink(val, dev->poll_limit_ns);
> dev->poll_limit_ns = val;
> }
> --
> 2.17.1
>
>
>
Looks good.
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
next prev parent reply other threads:[~2024-02-01 19:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 13:59 [PATCH] cpuidle: do not shrink guest poll_limit_ns below grow_start Parshuram Sangle
2024-02-01 18:45 ` Marcelo Tosatti [this message]
2024-02-12 16:03 ` Rafael J. Wysocki
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=ZbvmrdBkeOK71KGg@tpad \
--to=mtosatti@redhat.com \
--cc=daniel.lezcano@linaro.org \
--cc=jaishankar.rajendran@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=parshuram.sangle@intel.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).