diff mbox series

[45/49] ACPI: replace nodes__weight with nodes_weight_ge for numa

Message ID 20220210224933.379149-46-yury.norov@gmail.com
State New
Headers show
Series None | expand

Commit Message

Yury Norov Feb. 10, 2022, 10:49 p.m. UTC
acpi_map_pxm_to_node() calls nodes_weight() to compare the weight
of nodemask with a given number. We can do it more efficiently with
nodes_weight_eq() because conditional nodes_weight may stop
traversing the nodemask earlier, as soon as condition is (or is not)
met.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/acpi/numa/srat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki Feb. 14, 2022, 7:18 p.m. UTC | #1
On Fri, Feb 11, 2022 at 1:31 AM Yury Norov <yury.norov@gmail.com> wrote:
>
> acpi_map_pxm_to_node() calls nodes_weight() to compare the weight
> of nodemask with a given number. We can do it more efficiently with
> nodes_weight_eq() because conditional nodes_weight may stop
> traversing the nodemask earlier, as soon as condition is (or is not)
> met.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
>  drivers/acpi/numa/srat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
> index 3b818ab186be..fe7a7996f553 100644
> --- a/drivers/acpi/numa/srat.c
> +++ b/drivers/acpi/numa/srat.c
> @@ -67,7 +67,7 @@ int acpi_map_pxm_to_node(int pxm)
>         node = pxm_to_node_map[pxm];
>
>         if (node == NUMA_NO_NODE) {
> -               if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
> +               if (nodes_weight_ge(nodes_found_map, MAX_NUMNODES))
>                         return NUMA_NO_NODE;
>                 node = first_unset_node(nodes_found_map);
>                 __acpi_map_pxm_to_node(pxm, node);
> --

Applied as 5.18 material, thanks!
Yury Norov Feb. 14, 2022, 7:34 p.m. UTC | #2
On Mon, Feb 14, 2022 at 08:18:27PM +0100, Rafael J. Wysocki wrote:
> On Fri, Feb 11, 2022 at 1:31 AM Yury Norov <yury.norov@gmail.com> wrote:
> >
> > acpi_map_pxm_to_node() calls nodes_weight() to compare the weight
> > of nodemask with a given number. We can do it more efficiently with
> > nodes_weight_eq() because conditional nodes_weight may stop
> > traversing the nodemask earlier, as soon as condition is (or is not)
> > met.
> >
> > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> > ---
> >  drivers/acpi/numa/srat.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
> > index 3b818ab186be..fe7a7996f553 100644
> > --- a/drivers/acpi/numa/srat.c
> > +++ b/drivers/acpi/numa/srat.c
> > @@ -67,7 +67,7 @@ int acpi_map_pxm_to_node(int pxm)
> >         node = pxm_to_node_map[pxm];
> >
> >         if (node == NUMA_NO_NODE) {
> > -               if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
> > +               if (nodes_weight_ge(nodes_found_map, MAX_NUMNODES))
> >                         return NUMA_NO_NODE;
> >                 node = first_unset_node(nodes_found_map);
> >                 __acpi_map_pxm_to_node(pxm, node);
> > --
> 
> Applied as 5.18 material, thanks!

It depends on patches 44 and 26. Are you applying them too?
Rafael J. Wysocki Feb. 14, 2022, 7:45 p.m. UTC | #3
On Mon, Feb 14, 2022 at 8:36 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> On Mon, Feb 14, 2022 at 08:18:27PM +0100, Rafael J. Wysocki wrote:
> > On Fri, Feb 11, 2022 at 1:31 AM Yury Norov <yury.norov@gmail.com> wrote:
> > >
> > > acpi_map_pxm_to_node() calls nodes_weight() to compare the weight
> > > of nodemask with a given number. We can do it more efficiently with
> > > nodes_weight_eq() because conditional nodes_weight may stop
> > > traversing the nodemask earlier, as soon as condition is (or is not)
> > > met.
> > >
> > > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> > > ---
> > >  drivers/acpi/numa/srat.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
> > > index 3b818ab186be..fe7a7996f553 100644
> > > --- a/drivers/acpi/numa/srat.c
> > > +++ b/drivers/acpi/numa/srat.c
> > > @@ -67,7 +67,7 @@ int acpi_map_pxm_to_node(int pxm)
> > >         node = pxm_to_node_map[pxm];
> > >
> > >         if (node == NUMA_NO_NODE) {
> > > -               if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
> > > +               if (nodes_weight_ge(nodes_found_map, MAX_NUMNODES))
> > >                         return NUMA_NO_NODE;
> > >                 node = first_unset_node(nodes_found_map);
> > >                 __acpi_map_pxm_to_node(pxm, node);
> > > --
> >
> > Applied as 5.18 material, thanks!
>
> It depends on patches 44 and 26. Are you applying them too?

No, I'm not (I've only received this one directly).

I'll drop this patch now and please feel free to add my ACK to it.

Thanks!
Yury Norov Feb. 14, 2022, 7:55 p.m. UTC | #4
On Mon, Feb 14, 2022 at 11:45 AM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Mon, Feb 14, 2022 at 8:36 PM Yury Norov <yury.norov@gmail.com> wrote:
> >
> > On Mon, Feb 14, 2022 at 08:18:27PM +0100, Rafael J. Wysocki wrote:
> > > On Fri, Feb 11, 2022 at 1:31 AM Yury Norov <yury.norov@gmail.com> wrote:
> > > >
> > > > acpi_map_pxm_to_node() calls nodes_weight() to compare the weight
> > > > of nodemask with a given number. We can do it more efficiently with
> > > > nodes_weight_eq() because conditional nodes_weight may stop
> > > > traversing the nodemask earlier, as soon as condition is (or is not)
> > > > met.
> > > >
> > > > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> > > > ---
> > > >  drivers/acpi/numa/srat.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
> > > > index 3b818ab186be..fe7a7996f553 100644
> > > > --- a/drivers/acpi/numa/srat.c
> > > > +++ b/drivers/acpi/numa/srat.c
> > > > @@ -67,7 +67,7 @@ int acpi_map_pxm_to_node(int pxm)
> > > >         node = pxm_to_node_map[pxm];
> > > >
> > > >         if (node == NUMA_NO_NODE) {
> > > > -               if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
> > > > +               if (nodes_weight_ge(nodes_found_map, MAX_NUMNODES))
> > > >                         return NUMA_NO_NODE;
> > > >                 node = first_unset_node(nodes_found_map);
> > > >                 __acpi_map_pxm_to_node(pxm, node);
> > > > --
> > >
> > > Applied as 5.18 material, thanks!
> >
> > It depends on patches 44 and 26. Are you applying them too?
>
> No, I'm not (I've only received this one directly).
>
> I'll drop this patch now and please feel free to add my ACK to it.

OK, thanks.
diff mbox series

Patch

diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
index 3b818ab186be..fe7a7996f553 100644
--- a/drivers/acpi/numa/srat.c
+++ b/drivers/acpi/numa/srat.c
@@ -67,7 +67,7 @@  int acpi_map_pxm_to_node(int pxm)
 	node = pxm_to_node_map[pxm];
 
 	if (node == NUMA_NO_NODE) {
-		if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
+		if (nodes_weight_ge(nodes_found_map, MAX_NUMNODES))
 			return NUMA_NO_NODE;
 		node = first_unset_node(nodes_found_map);
 		__acpi_map_pxm_to_node(pxm, node);