[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MN2PR21MB12954BFF215726B0E6C3C253CA5D9@MN2PR21MB1295.namprd21.prod.outlook.com>
Date: Sun, 23 Jan 2022 22:02:09 +0000
From: Haiyang Zhang <haiyangz@...rosoft.com>
To: Yury Norov <yury.norov@...il.com>,
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-kernel@...r.kernel.org>,
KY Srinivasan <kys@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
Subject: RE: [PATCH 43/54] drivers/hv: replace cpumask_weight with
cpumask_weight_eq
> -----Original Message-----
> From: Yury Norov <yury.norov@...il.com>
> Sent: Sunday, January 23, 2022 1:39 PM
> To: Yury Norov <yury.norov@...il.com>; 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; KY Srinivasan
> <kys@...rosoft.com>; Haiyang Zhang <haiyangz@...rosoft.com>; Stephen Hemminger
> <sthemmin@...rosoft.com>; Wei Liu <wei.liu@...nel.org>; Dexuan Cui <decui@...rosoft.com>;
> linux-hyperv@...r.kernel.org
> Subject: [PATCH 43/54] drivers/hv: replace cpumask_weight with cpumask_weight_eq
>
> init_vp_index() calls cpumask_weight() to compare the weights of cpumasks
> We can do it more efficiently with cpumask_weight_eq because conditional
> cpumask_weight may stop traversing the cpumask earlier (at least one), as
> soon as condition is met.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
> drivers/hv/channel_mgmt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index 60375879612f..7420a5fd47b5 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -762,8 +762,8 @@ static void init_vp_index(struct vmbus_channel *channel)
> }
> alloced_mask = &hv_context.hv_numa_map[numa_node];
>
> - if (cpumask_weight(alloced_mask) ==
> - cpumask_weight(cpumask_of_node(numa_node))) {
> + if (cpumask_weight_eq(alloced_mask,
> + cpumask_weight(cpumask_of_node(numa_node)))) {
> /*
> * We have cycled through all the CPUs in the node;
> * reset the alloced map.
Thanks.
Reviewed-by: Haiyang Zhang <haiyangz@...rosoft.com>
Powered by blists - more mailing lists