[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgY88xvaXsA/CUTp@kernel.org>
Date: Fri, 11 Feb 2022 12:39:47 +0200
From: Mike Rapoport <rppt@...nel.org>
To: Yury Norov <yury.norov@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Peter Zijlstra <peterz@...radead.org>,
David Laight <David.Laight@...lab.com>,
Joe Perches <joe@...ches.com>, Dennis Zhou <dennis@...nel.org>,
Emil Renner Berthing <kernel@...il.dk>,
Nicholas Piggin <npiggin@...il.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Alexey Klimov <aklimov@...hat.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 24/49] mm/vmstat: replace cpumask_weight with
cpumask_empty where appropriate
On Thu, Feb 10, 2022 at 02:49:08PM -0800, Yury Norov wrote:
> mm/vmstat.c code calls cpumask_weight() to check if any bit of a given
> cpumask is set. We can do it more efficiently with cpumask_empty() because
> cpumask_empty() stops traversing the cpumask as soon as it finds first set
> bit, while cpumask_weight() counts all bits unconditionally.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
Acked-by: Mike Rapoport <rppt@...ux.ibm.com>
> ---
> mm/vmstat.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index d5cc8d739fac..27a94afd4ee5 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -2041,7 +2041,7 @@ static void __init init_cpu_node_state(void)
> int node;
>
> for_each_online_node(node) {
> - if (cpumask_weight(cpumask_of_node(node)) > 0)
> + if (!cpumask_empty(cpumask_of_node(node)))
> node_set_state(node, N_CPU);
> }
> }
> @@ -2068,7 +2068,7 @@ static int vmstat_cpu_dead(unsigned int cpu)
>
> refresh_zone_stat_thresholds();
> node_cpus = cpumask_of_node(node);
> - if (cpumask_weight(node_cpus) > 0)
> + if (!cpumask_empty(node_cpus))
> return 0;
>
> node_clear_state(node, N_CPU);
> --
> 2.32.0
>
>
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists