* [PATCH v3 1/3] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity
@ 2026-03-15 20:10 Adrián García Casado
0 siblings, 0 replies; 3+ messages in thread
From: Adrián García Casado @ 2026-03-15 20:10 UTC (permalink / raw)
To: Miri Korenblit
Cc: linux-wireless, linux-kernel, Miguel Ojeda,
Adrián García Casado
Implement a balanced RSS queue distribution by skipping CPU0 for
high-rate MSI-X interrupts when multiple CPUs are online. This reduces
contention with system housekeeping tasks on the boot core and improves
overall throughput.
Signed-off-by: Adrián García Casado <adriangarciacasado42@gmail.com>
---
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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 4560d92d7..87149f29e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
@@ -1683,7 +1683,17 @@ static void iwl_pcie_irq_set_affinity(struct iwl_trans *trans,
* 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);
+ 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);
+
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]);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3 1/3] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity
@ 2026-03-15 20:16 Adrián García Casado
2026-03-16 10:32 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Adrián García Casado @ 2026-03-15 20:16 UTC (permalink / raw)
To: Miri Korenblit
Cc: linux-wireless, linux-kernel, Miguel Ojeda,
Adrián García Casado
Implement a balanced RSS queue distribution by skipping CPU0 for
high-rate MSI-X interrupts when multiple CPUs are online. This reduces
contention with system housekeeping tasks on the boot core and improves
overall throughput.
Signed-off-by: Adrián García Casado <adriangarciacasado42@gmail.com>
---
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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 4560d92d7..87149f29e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
@@ -1683,7 +1683,17 @@ static void iwl_pcie_irq_set_affinity(struct iwl_trans *trans,
* 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);
+ 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);
+
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]);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 1/3] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity
2026-03-15 20:16 [PATCH v3 1/3] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity Adrián García Casado
@ 2026-03-16 10:32 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2026-03-16 10:32 UTC (permalink / raw)
To: Adrián García Casado, Miri Korenblit
Cc: linux-wireless, linux-kernel, Miguel Ojeda
Hi,
Somehow you messed up reposting this - the whole v2 series appears twice
and the v3 of this patch appears twice but without the rest of the
series?
> Implement a balanced RSS queue distribution by skipping CPU0 for
> high-rate MSI-X interrupts when multiple CPUs are online. This reduces
> contention with system housekeeping tasks on the boot core and improves
> overall throughput.
*Does* it improve throughput though? You should back up such claims with
numbers ... I doubt it would (unconditionally). It's not like the system
is going to be *really busy* all the time with housekeeping etc., and
the boot core is probably going to be a P-core, where you might have a
system with only 2 P-cores and 4-8 E (or even smaller) cores. This
likely also breaks some Intel-internal system requirements, but that
could be debated with the right folks.
Either way,
> --- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
> +++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
> @@ -1683,7 +1683,17 @@ static void iwl_pcie_irq_set_affinity(struct iwl_trans *trans,
> * 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);
> + 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);
> +
this is wrong since you really then should allocate one queue less,
rather than mapping two queues to the same core.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-16 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 20:16 [PATCH v3 1/3] wifi: iwlwifi: pcie: optimize MSI-X interrupt affinity Adrián García Casado
2026-03-16 10:32 ` Johannes Berg
-- strict thread matches above, loose matches on Subject: below --
2026-03-15 20:10 Adrián García Casado
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox