Linux-Watchdog Archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Dawei Li <set_pte_at@outlook.com>
Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog/wdt-main: Use cpumask_of() to avoid cpumask var on stack
Date: Wed, 10 Apr 2024 07:48:02 -0700	[thread overview]
Message-ID: <8be5a179-df13-4441-8276-504dcb925026@roeck-us.net> (raw)
In-Reply-To: <TYTP286MB3564B037A81DAAE1AC3A16F3CA062@TYTP286MB3564.JPNP286.PROD.OUTLOOK.COM>

On Wed, Apr 10, 2024 at 09:13:59PM +0800, Dawei Li wrote:
> In general it's preferable to avoid placing cpumasks on the stack, as
> for large values of NR_CPUS these can consume significant amounts of
> stack space and make stack overflows more likely.
> 
> Use cpumask_of() to avoid the need for a temporary cpumask on the stack
> 
> Signed-off-by: Dawei Li <set_pte_at@outlook.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/octeon-wdt-main.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c
> index 0fe71f7e66d5..52d49e4e35a0 100644
> --- a/drivers/watchdog/octeon-wdt-main.c
> +++ b/drivers/watchdog/octeon-wdt-main.c
> @@ -381,11 +381,7 @@ static int octeon_wdt_cpu_online(unsigned int cpu)
>  
>  	/* Must set the irq affinity here */
>  	if (octeon_has_feature(OCTEON_FEATURE_CIU3)) {
> -		cpumask_t mask;
> -
> -		cpumask_clear(&mask);
> -		cpumask_set_cpu(cpu, &mask);
> -		irq_set_affinity(irq, &mask);
> +		irq_set_affinity(irq, cpumask_of(cpu));
>  	}
>  
>  	cpumask_set_cpu(cpu, &irq_enabled_cpus);
> -- 
> 2.25.1
> 

      reply	other threads:[~2024-04-10 14:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 13:13 [PATCH] watchdog/wdt-main: Use cpumask_of() to avoid cpumask var on stack Dawei Li
2024-04-10 14:48 ` Guenter Roeck [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=8be5a179-df13-4441-8276-504dcb925026@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=set_pte_at@outlook.com \
    --cc=wim@linux-watchdog.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 read-only IMAP folder(s) and NNTP newsgroup(s).