* [PATCH v6] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity
@ 2026-03-19 17:38 Adrián García Casado
2026-03-19 18:00 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Adrián García Casado @ 2026-03-19 17:38 UTC (permalink / raw)
To: Miri Korenblit
Cc: linux-wireless, linux-kernel, Miguel Ojeda,
Adrián García Casado
Balanced distribution: skip CPU0 for high-rate RSS queues to avoid contention with system housekeeping. Use a stateful last_cpu approach to ensure unique core assignment when skipping CPU0. This avoids mapping multiple queues to the same core.
Addressing kbuild robot warning: remove unused 'offset' variable.
Signed-off-by: Adrián García Casado <adriangarciacasado42@gmail.com>
---
.../intel/iwlwifi/pcie/gen1_2/trans.c | 20 ++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
index 4560d92d76fe0..1d0dcf0bc7686 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
@@ -1672,18 +1672,28 @@ static void iwl_pcie_irq_set_affinity(struct iwl_trans *trans,
struct iwl_trans_info *info)
{
#if defined(CONFIG_SMP)
- int iter_rx_q, i, ret, cpu, offset;
+ int iter_rx_q, i, ret, cpu, last_cpu;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
i = trans_pcie->shared_vec_mask & IWL_SHARED_IRQ_FIRST_RSS ? 0 : 1;
iter_rx_q = info->num_rxqs - 1 + i;
- offset = 1 + i;
+ last_cpu = -1;
for (; i < iter_rx_q ; i++) {
/*
- * Get the cpu prior to the place to search
- * (i.e. return will be > i - 1).
+ * Balanced distribution: skip CPU0 for high-rate RSS queues
+ * to avoid contention with system housekeeping.
*/
- cpu = cpumask_next(i - offset, cpu_online_mask);
+ cpu = cpumask_next(last_cpu, cpu_online_mask);
+ if (cpu >= nr_cpu_ids)
+ cpu = cpumask_first(cpu_online_mask);
+
+ if (cpu == 0 && num_online_cpus() > 1) {
+ cpu = cpumask_next(0, cpu_online_mask);
+ if (cpu >= nr_cpu_ids)
+ cpu = cpumask_first(cpu_online_mask);
+ }
+ last_cpu = cpu;
+
cpumask_set_cpu(cpu, &trans_pcie->affinity_mask[i]);
ret = irq_set_affinity_hint(trans_pcie->msix_entries[i].vector,
&trans_pcie->affinity_mask[i]);
base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v6] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity
2026-03-19 17:38 [PATCH v6] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity Adrián García Casado
@ 2026-03-19 18:00 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2026-03-19 18:00 UTC (permalink / raw)
To: Adrián García Casado, Miri Korenblit
Cc: linux-wireless, linux-kernel, Miguel Ojeda
On Thu, 2026-03-19 at 18:38 +0100, Adrián García Casado wrote:
> Balanced distribution: skip CPU0 for high-rate RSS queues to avoid contention with system housekeeping. Use a stateful last_cpu approach to ensure unique core assignment when skipping CPU0. This avoids mapping multiple queues to the same core.
>
> Addressing kbuild robot warning: remove unused 'offset' variable.
You might do well to address human reviewer feedback as well, really
_first_. You're just digging a deeper and deeper hole for yourself here.
johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-19 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-19 17:38 [PATCH v6] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity Adrián García Casado
2026-03-19 18:00 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®