瀏覽代碼

cpumask: convert drivers/net/sfc

Impact: reduce stack usage, use new cpumask API.

Remove a cpumask from the stack.  Ben Hutchings indicated that printing
a warning and returning 1 was acceptable for the corner case where allocation
fails.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>
Cc: linux-net-drivers@solarflare.com
Rusty Russell 16 年之前
父節點
當前提交
2f8975fbcf
共有 1 個文件被更改,包括 11 次插入4 次删除
  1. 11 4
      drivers/net/sfc/efx.c

+ 11 - 4
drivers/net/sfc/efx.c

@@ -854,20 +854,27 @@ static void efx_fini_io(struct efx_nic *efx)
  * interrupts across them. */
  * interrupts across them. */
 static int efx_wanted_rx_queues(void)
 static int efx_wanted_rx_queues(void)
 {
 {
-	cpumask_t core_mask;
+	cpumask_var_t core_mask;
 	int count;
 	int count;
 	int cpu;
 	int cpu;
 
 
-	cpus_clear(core_mask);
+	if (!alloc_cpumask_var(&core_mask, GFP_KERNEL)) {
+		printk(KERN_WARNING
+		       "efx.c: allocation failure, irq balancing hobbled\n");
+		return 1;
+	}
+
+	cpumask_clear(core_mask);
 	count = 0;
 	count = 0;
 	for_each_online_cpu(cpu) {
 	for_each_online_cpu(cpu) {
-		if (!cpu_isset(cpu, core_mask)) {
+		if (!cpumask_test_cpu(cpu, core_mask)) {
 			++count;
 			++count;
-			cpumask_or(&core_mask, &core_mask,
+			cpumask_or(core_mask, core_mask,
 				   topology_core_cpumask(cpu));
 				   topology_core_cpumask(cpu));
 		}
 		}
 	}
 	}
 
 
+	free_cpumask_var(core_mask);
 	return count;
 	return count;
 }
 }