Re: [PATCH 09/16] irq: don't copy cpu affinity mask if source is equal to destination

Peter Zijlstra
2022-07-18T21:31:17Z

On Mon, Jul 18, 2022 at 12:28:37PM -0700, Yury Norov wrote:

> kernel/irq/manage.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 8c396319d5ac..f9c1b21584ec 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -284,7 +284,8 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
> switch (ret) {
> case IRQ_SET_MASK_OK:
> case IRQ_SET_MASK_OK_DONE:
> - cpumask_copy(desc->irq_common_data.affinity, mask);
> + if (desc->irq_common_data.affinity != mask)
> + cpumask_copy(desc->irq_common_data.affinity, mask);

Seems like mostly pointless logic at this point. This is not a
performance senstive operation afaik.

> fallthrough;
> case IRQ_SET_MASK_OK_NOCOPY:
> irq_validate_effective_affinity(data);
> --
> 2.34.1
>