public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB•COM>
To: 'Yunfeng Ye' <yeyunfeng@huawei•com>,
	"catalin.marinas@arm•com" <catalin.marinas@arm•com>,
	"will@kernel•org" <will@kernel•org>
Cc: "kstewart@linuxfoundation•org" <kstewart@linuxfoundation•org>,
	"ard.biesheuvel@linaro•org" <ard.biesheuvel@linaro•org>,
	"gregkh@linuxfoundation•org" <gregkh@linuxfoundation•org>,
	"linux-kernel@vger•kernel.org" <linux-kernel@vger•kernel.org>,
	"tglx@linutronix•de" <tglx@linutronix•de>,
	"wuyun.wu@huawei•com" <wuyun.wu@huawei•com>,
	"linux-arm-kernel@lists•infradead.org"
	<linux-arm-kernel@lists•infradead.org>
Subject: RE: [PATCH] arm64: psci: Use udelay() instead of msleep() to reduce waiting time
Date: Thu, 12 Sep 2019 08:48:42 +0000	[thread overview]
Message-ID: <18c9fd22d72d4ea1a11e800e8873dd8d@AcuMS.aculab.com> (raw)
In-Reply-To: <e4d42bda-72f2-4002-f319-1cbe2bff74d2@huawei.com>

From: Yunfeng Ye
> Sent: 11 September 2019 09:50
> We want to reduce the time of cpu_down() for saving power, found that
> cpu_psci_cpu_kill() cost 10ms after psci_ops.affinity_info() fail.
> 
> Normally the time cpu dead is very short, it is no need to wait 10ms.
> so use udelay 10us to instead msleep 10ms in every waiting loop, and add
> cond_resched() to give a chance to run a higher-priority process.
> 
> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei•com>
> ---
>  arch/arm64/kernel/psci.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
> index 85ee7d0..9e9d8a6 100644
> --- a/arch/arm64/kernel/psci.c
> +++ b/arch/arm64/kernel/psci.c
> @@ -86,15 +86,15 @@ static int cpu_psci_cpu_kill(unsigned int cpu)
>  	 * while it is dying. So, try again a few times.
>  	 */
> 
> -	for (i = 0; i < 10; i++) {
> +	for (i = 0; i < 10000; i++) {
>  		err = psci_ops.affinity_info(cpu_logical_map(cpu), 0);
>  		if (err == PSCI_0_2_AFFINITY_LEVEL_OFF) {
>  			pr_info("CPU%d killed.\n", cpu);
>  			return 0;
>  		}
> 
> -		msleep(10);
> -		pr_info("Retrying again to check for CPU kill\n");
> +		cond_resched();
> +		udelay(10);

You really don't want to be doing 10000 udelay(10) before giving up.

If udelay(10) is long enough for the normal case, then do that once.
After that use usleep_range().

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-09-12  8:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11  8:50 [PATCH] arm64: psci: Use udelay() instead of msleep() to reduce waiting time Yunfeng Ye
2019-09-12  8:48 ` David Laight [this message]
2019-09-16 15:26   ` Yunfeng Ye

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=18c9fd22d72d4ea1a11e800e8873dd8d@AcuMS.aculab.com \
    --to=david.laight@aculab$(echo .)com \
    --cc=ard.biesheuvel@linaro$(echo .)org \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=kstewart@linuxfoundation$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=tglx@linutronix$(echo .)de \
    --cc=will@kernel$(echo .)org \
    --cc=wuyun.wu@huawei$(echo .)com \
    --cc=yeyunfeng@huawei$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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