* [PATCH] powerpc/xive: Use cpumask_intersects()
@ 2024-09-06 17:49 Costa Shulyupin
2024-09-07 1:36 ` Ming Lei
2024-09-09 5:28 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Costa Shulyupin @ 2024-09-06 17:49 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Costa Shulyupin, Bjorn Helgaas, linuxppc-dev, linux-kernel
Cc: ming.lei
Replace `cpumask_any_and(a, b) >= nr_cpu_ids`
with the more readable `!cpumask_intersects(a, b)`.
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
arch/powerpc/sysdev/xive/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index fa01818c1972c..a6c388bdf5d08 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -726,7 +726,7 @@ static int xive_irq_set_affinity(struct irq_data *d,
pr_debug("%s: irq %d/0x%x\n", __func__, d->irq, hw_irq);
/* Is this valid ? */
- if (cpumask_any_and(cpumask, cpu_online_mask) >= nr_cpu_ids)
+ if (!cpumask_intersects(cpumask, cpu_online_mask))
return -EINVAL;
/*
--
2.45.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/xive: Use cpumask_intersects()
2024-09-06 17:49 [PATCH] powerpc/xive: Use cpumask_intersects() Costa Shulyupin
@ 2024-09-07 1:36 ` Ming Lei
2024-09-09 5:28 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2024-09-07 1:36 UTC (permalink / raw)
To: Costa Shulyupin
Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Bjorn Helgaas, linuxppc-dev, linux-kernel
On Sat, Sep 7, 2024 at 1:50 AM Costa Shulyupin <costa.shul@redhat.com> wrote:
>
> Replace `cpumask_any_and(a, b) >= nr_cpu_ids`
> with the more readable `!cpumask_intersects(a, b)`.
>
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
> arch/powerpc/sysdev/xive/common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
> index fa01818c1972c..a6c388bdf5d08 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -726,7 +726,7 @@ static int xive_irq_set_affinity(struct irq_data *d,
> pr_debug("%s: irq %d/0x%x\n", __func__, d->irq, hw_irq);
>
> /* Is this valid ? */
> - if (cpumask_any_and(cpumask, cpu_online_mask) >= nr_cpu_ids)
> + if (!cpumask_intersects(cpumask, cpu_online_mask))
> return -EINVAL;
Reviewed-by: Ming Lei <ming.lei@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/xive: Use cpumask_intersects()
2024-09-06 17:49 [PATCH] powerpc/xive: Use cpumask_intersects() Costa Shulyupin
2024-09-07 1:36 ` Ming Lei
@ 2024-09-09 5:28 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2024-09-09 5:28 UTC (permalink / raw)
To: Costa Shulyupin, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Costa Shulyupin, Bjorn Helgaas, linuxppc-dev, linux-kernel
Cc: ming.lei
Costa Shulyupin <costa.shul@redhat.com> writes:
> Replace `cpumask_any_and(a, b) >= nr_cpu_ids`
> with the more readable `!cpumask_intersects(a, b)`.
I agree it's more readable.
It would be nice if the change log told me that both functions have
similar performance behaviour. I'm not saying this is a super hot path,
but CPU masks can get pretty big, and some cpumask routines compute the
full mask while others short-circuit.
cheers
> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
> index fa01818c1972c..a6c388bdf5d08 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -726,7 +726,7 @@ static int xive_irq_set_affinity(struct irq_data *d,
> pr_debug("%s: irq %d/0x%x\n", __func__, d->irq, hw_irq);
>
> /* Is this valid ? */
> - if (cpumask_any_and(cpumask, cpu_online_mask) >= nr_cpu_ids)
> + if (!cpumask_intersects(cpumask, cpu_online_mask))
> return -EINVAL;
>
> /*
> --
> 2.45.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-09 5:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 17:49 [PATCH] powerpc/xive: Use cpumask_intersects() Costa Shulyupin
2024-09-07 1:36 ` Ming Lei
2024-09-09 5:28 ` Michael Ellerman
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 NNTP newsgroup(s).