Commit 5f0b6c94 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'avoid-explicit-cpumask-var-allocation-on-stack'

Dawei Li says:

====================
Avoid explicit cpumask var allocation on stack

v1: https://lore.kernel.org/lkml/20240329105610.922675-1-dawei.li@shingroup.cn/
====================

Link: https://lore.kernel.org/r/20240331053441.1276826-1-dawei.li@shingroup.cnSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents ad6afdfc d33fe171
......@@ -2896,11 +2896,14 @@ static int dpaa2_eth_xdp_xmit(struct net_device *net_dev, int n,
static int update_xps(struct dpaa2_eth_priv *priv)
{
struct net_device *net_dev = priv->net_dev;
struct cpumask xps_mask;
struct dpaa2_eth_fq *fq;
int i, num_queues, netdev_queues;
struct dpaa2_eth_fq *fq;
cpumask_var_t xps_mask;
int err = 0;
if (!alloc_cpumask_var(&xps_mask, GFP_KERNEL))
return -ENOMEM;
num_queues = dpaa2_eth_queue_count(priv);
netdev_queues = (net_dev->num_tc ? : 1) * num_queues;
......@@ -2910,16 +2913,17 @@ static int update_xps(struct dpaa2_eth_priv *priv)
for (i = 0; i < netdev_queues; i++) {
fq = &priv->fq[i % num_queues];
cpumask_clear(&xps_mask);
cpumask_set_cpu(fq->target_cpu, &xps_mask);
cpumask_clear(xps_mask);
cpumask_set_cpu(fq->target_cpu, xps_mask);
err = netif_set_xps_queue(net_dev, &xps_mask, i);
err = netif_set_xps_queue(net_dev, xps_mask, i);
if (err) {
netdev_warn_once(net_dev, "Error setting XPS queue\n");
break;
}
}
free_cpumask_var(xps_mask);
return err;
}
......
......@@ -520,7 +520,7 @@ static void iucv_setmask_mp(void)
*/
static void iucv_setmask_up(void)
{
cpumask_t cpumask;
static cpumask_t cpumask;
int cpu;
/* Disable all cpu but the first in cpu_irq_cpumask. */
......@@ -628,23 +628,33 @@ static int iucv_cpu_online(unsigned int cpu)
static int iucv_cpu_down_prep(unsigned int cpu)
{
cpumask_t cpumask;
cpumask_var_t cpumask;
int ret = 0;
if (!iucv_path_table)
return 0;
cpumask_copy(&cpumask, &iucv_buffer_cpumask);
cpumask_clear_cpu(cpu, &cpumask);
if (cpumask_empty(&cpumask))
if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
return -ENOMEM;
cpumask_copy(cpumask, &iucv_buffer_cpumask);
cpumask_clear_cpu(cpu, cpumask);
if (cpumask_empty(cpumask)) {
/* Can't offline last IUCV enabled cpu. */
return -EINVAL;
ret = -EINVAL;
goto __free_cpumask;
}
iucv_retrieve_cpu(NULL);
if (!cpumask_empty(&iucv_irq_cpumask))
return 0;
goto __free_cpumask;
smp_call_function_single(cpumask_first(&iucv_buffer_cpumask),
iucv_allow_cpu, NULL, 1);
return 0;
__free_cpumask:
free_cpumask_var(cpumask);
return ret;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment