cpus_read_lock();
else
preempt_disable();
- switch (scfsp->scfs_prim) {
- case SCF_PRIM_SINGLE:
+ if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) {
scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC);
if (WARN_ON_ONCE(!scfcp))
atomic_inc(&n_alloc_errs);
+ }
+ switch (scfsp->scfs_prim) {
+ case SCF_PRIM_SINGLE:
cpu = torture_random(trsp) % nr_cpu_ids;
if (scfsp->scfs_wait)
scfp->n_single_wait++;
}
break;
case SCF_PRIM_MANY:
- if (scfsp->scfs_wait) {
- scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC);
- if (WARN_ON_ONCE(!scfcp))
- atomic_inc(&n_alloc_errs);
- }
if (scfsp->scfs_wait)
scfp->n_many_wait++;
else
scfp->n_all_wait++;
else
scfp->n_all++;
- smp_call_function(scf_handler, NULL, scfsp->scfs_wait);
+ if (scfcp) {
+ scfcp->scfc_cpu = -1;
+ scfcp->scfc_wait = true;
+ scfcp->scfc_out = false;
+ scfcp->scfc_in = true;
+ }
+ smp_call_function(scf_handler, scfcp, scfsp->scfs_wait);
+ if (scfcp) {
+ if (WARN_ON_ONCE(!scfcp->scfc_out))
+ atomic_inc(&n_mb_out_errs); // Leak rather than trash!
+ else
+ kfree(scfcp);
+ }
break;
}
if (use_cpus_read_lock)