Revert "io_uring/sqpoll: do not put cpumask on stack"

This reverts commit 43d03276a6.
This commit is contained in:
Ksawlii 2024-11-24 00:22:52 +01:00
parent f3da6367d0
commit 7ea1210e5d

View file

@ -8775,22 +8775,15 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
return 0; return 0;
if (p->flags & IORING_SETUP_SQ_AFF) { if (p->flags & IORING_SETUP_SQ_AFF) {
cpumask_var_t allowed_mask; struct cpumask allowed_mask;
int cpu = p->sq_thread_cpu; int cpu = p->sq_thread_cpu;
ret = -EINVAL; ret = -EINVAL;
if (cpu >= nr_cpu_ids || !cpu_online(cpu)) if (cpu >= nr_cpu_ids || !cpu_online(cpu))
goto err_sqpoll; goto err_sqpoll;
ret = -ENOMEM; cpuset_cpus_allowed(current, &allowed_mask);
if (!alloc_cpumask_var(&allowed_mask, GFP_KERNEL)) if (!cpumask_test_cpu(cpu, &allowed_mask))
goto err_sqpoll; goto err_sqpoll;
ret = -EINVAL;
cpuset_cpus_allowed(current, allowed_mask);
if (!cpumask_test_cpu(cpu, allowed_mask)) {
free_cpumask_var(allowed_mask);
goto err_sqpoll;
}
free_cpumask_var(allowed_mask);
sqd->sq_cpu = cpu; sqd->sq_cpu = cpu;
} else { } else {
sqd->sq_cpu = -1; sqd->sq_cpu = -1;