Commit 676e5469 authored by Paul E. McKenney's avatar Paul E. McKenney

scftorture: Consolidate scftorture_invoke_one() check and kfree()

This commit moves checking of the ->scfc_out field and the freeing of
the scf_check structure down below the end of switch statement, thus
saving a few lines of code.
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 34e8c483
...@@ -289,7 +289,7 @@ static void scf_handler_1(void *scfc_in) ...@@ -289,7 +289,7 @@ static void scf_handler_1(void *scfc_in)
static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_random_state *trsp) static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_random_state *trsp)
{ {
uintptr_t cpu; uintptr_t cpu;
int ret; int ret = 0;
struct scf_check *scfcp = NULL; struct scf_check *scfcp = NULL;
struct scf_selector *scfsp = scf_sel_rand(trsp); struct scf_selector *scfsp = scf_sel_rand(trsp);
...@@ -322,11 +322,7 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra ...@@ -322,11 +322,7 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
else else
scfp->n_single_ofl++; scfp->n_single_ofl++;
kfree(scfcp); kfree(scfcp);
} else if (scfcp && scfsp->scfs_wait) { scfcp = NULL;
if (WARN_ON_ONCE(!scfcp->scfc_out))
atomic_inc(&n_mb_out_errs); // Leak rather than trash!
else
kfree(scfcp);
} }
break; break;
case SCF_PRIM_MANY: case SCF_PRIM_MANY:
...@@ -341,12 +337,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra ...@@ -341,12 +337,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
scfcp->scfc_in = true; scfcp->scfc_in = true;
} }
smp_call_function_many(cpu_online_mask, scf_handler, scfcp, scfsp->scfs_wait); smp_call_function_many(cpu_online_mask, 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; break;
case SCF_PRIM_ALL: case SCF_PRIM_ALL:
if (scfsp->scfs_wait) if (scfsp->scfs_wait)
...@@ -360,14 +350,14 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra ...@@ -360,14 +350,14 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
scfcp->scfc_in = true; scfcp->scfc_in = true;
} }
smp_call_function(scf_handler, scfcp, scfsp->scfs_wait); smp_call_function(scf_handler, scfcp, scfsp->scfs_wait);
if (scfcp) { break;
}
if (scfcp && scfsp->scfs_wait) {
if (WARN_ON_ONCE(!scfcp->scfc_out)) if (WARN_ON_ONCE(!scfcp->scfc_out))
atomic_inc(&n_mb_out_errs); // Leak rather than trash! atomic_inc(&n_mb_out_errs); // Leak rather than trash!
else else
kfree(scfcp); kfree(scfcp);
} }
break;
}
if (use_cpus_read_lock) if (use_cpus_read_lock)
cpus_read_unlock(); cpus_read_unlock();
else else
......
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