Re: [PATCH] genirq: Own affinity hint

From: Thomas Gleixner
Date: Wed Oct 25 2023 - 16:10:48 EST


On Wed, Oct 25 2023 at 16:15, Jakub Sitnicki wrote:
> @@ -55,26 +55,33 @@ static int alloc_masks(struct irq_desc *desc, int node)
> {
> if (!zalloc_cpumask_var_node(&desc->irq_common_data.affinity,
> GFP_KERNEL, node))
> - return -ENOMEM;
> + goto err_affinity;
> + if (!zalloc_cpumask_var_node(&desc->irq_common_data.affinity_hint,
> + GFP_KERNEL, node))

This gets allocated for every interrupt descriptor but only a few or
even none will ever use it. Seriously no.

> + goto err_affinity_hint;
>
> #ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
> if (!zalloc_cpumask_var_node(&desc->irq_common_data.effective_affinity,
> - GFP_KERNEL, node)) {
> - free_cpumask_var(desc->irq_common_data.affinity);
> - return -ENOMEM;
> - }
> + GFP_KERNEL, node))
> + goto err_effective_affinity;
> #endif
>
> #ifdef CONFIG_GENERIC_PENDING_IRQ
> - if (!zalloc_cpumask_var_node(&desc->pending_mask, GFP_KERNEL, node)) {
> -#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
> - free_cpumask_var(desc->irq_common_data.effective_affinity);
> -#endif
> - free_cpumask_var(desc->irq_common_data.affinity);
> - return -ENOMEM;
> - }
> + if (!zalloc_cpumask_var_node(&desc->pending_mask, GFP_KERNEL, node))
> + goto err_pending_mask;
> #endif
> return 0;
> +
> +err_pending_mask:

How is this supposed to compile with CONFIG_GENERIC_PENDING_IRQ=n ?

> +#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
> + free_cpumask_var(desc->irq_common_data.effective_affinity);
> +#endif
> +err_effective_affinity:

and this with CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=n ?

Thanks,

tglx