Re: [PATCH] net/mlx5: Update mlx5_irq.mask when IRQ affinity changes

From: Tariq Toukan

Date: Sun May 17 2026 - 04:58:59 EST




On 14/05/2026 10:42, Yi Li wrote:
mlx5_irq.mask is used for:
1) Setting IRQ affinity_hint in mlx5_irq_alloc()
2) Determining mlx5e_channel.cpu in mlx5e_open_channel(), which in turn
decides the NUMA node for queue allocations.

When a user modifies IRQ affinity, mlx5_irq.mask remains unchanged.
Consequently even if mlx5e_open_channel() is invoked again, queues are
still allocated on the original NUMA node instead of the newly
preferred one.

Fix this by registering an irq_set_affinity_notifier to update
mlx5_irq.mask when /proc/irq/N/smp_affinity is modified.
Therefore subsequent queue allocations reflect the updated affinity.

Signed-off-by: Yi Li <liyi@xxxxxxxx>
---

Hi,

Thanks for the patch. Looking at the proposal, I want to discuss two distinct aspects:

NAPI Execution Location: We already track effective affinity closely through irq_get_effective_affinity_mask(); NAPI processing is dynamically moved accordingly, including a forced NAPI cycle break if needed.

Memory Allocation Location: This is the core focus of your patch.

I have serious comments on the proposed implementation, but first I want to discuss the idea.

We investigated a similar approach a few years ago but ultimately decided against upstreaming it due to stability concerns:

High Volatility: The "current affinity" value can be extremely dynamic, potentially shifting multiple times per second depending on system load and tuning.

Performance Risk: Sampling a highly volatile "current" value to allocate relatively permanent resources (like channel queues) risks severe worst-case performance regressions if the affinity shifts immediately after allocation.

Because of this, we have historically relied on numa-distance logic for channel allocations to ensure a predictable baseline.

Do you have any benchmark data or specific use cases showing a clear net benefit over the existing numa-distance logic?

Best regards,
Tariq