Commit 4df55bdd authored by Paul E. McKenney's avatar Paul E. McKenney

scftorture: Consolidate scftorture_invoke_one() scf_check initialization

This commit hoists much of the initialization of the scf_check
structure out of the switch statement, thus saving a few lines of code.
The initialization of the ->scfc_in field remains in each leg of the
switch statement in order to more heavily stress memory ordering.
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 676e5469
...@@ -299,8 +299,13 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra ...@@ -299,8 +299,13 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
preempt_disable(); preempt_disable();
if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) { if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) {
scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC); scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC);
if (WARN_ON_ONCE(!scfcp)) if (WARN_ON_ONCE(!scfcp)) {
atomic_inc(&n_alloc_errs); atomic_inc(&n_alloc_errs);
} else {
scfcp->scfc_cpu = -1;
scfcp->scfc_wait = scfsp->scfs_wait;
scfcp->scfc_out = false;
}
} }
switch (scfsp->scfs_prim) { switch (scfsp->scfs_prim) {
case SCF_PRIM_SINGLE: case SCF_PRIM_SINGLE:
...@@ -311,8 +316,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra ...@@ -311,8 +316,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
scfp->n_single++; scfp->n_single++;
if (scfcp) { if (scfcp) {
scfcp->scfc_cpu = cpu; scfcp->scfc_cpu = cpu;
scfcp->scfc_wait = scfsp->scfs_wait;
scfcp->scfc_out = false;
scfcp->scfc_in = true; scfcp->scfc_in = true;
} }
ret = smp_call_function_single(cpu, scf_handler_1, (void *)scfcp, scfsp->scfs_wait); ret = smp_call_function_single(cpu, scf_handler_1, (void *)scfcp, scfsp->scfs_wait);
...@@ -330,12 +333,8 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra ...@@ -330,12 +333,8 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
scfp->n_many_wait++; scfp->n_many_wait++;
else else
scfp->n_many++; scfp->n_many++;
if (scfcp) { if (scfcp)
scfcp->scfc_cpu = -1;
scfcp->scfc_wait = true;
scfcp->scfc_out = false;
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);
break; break;
case SCF_PRIM_ALL: case SCF_PRIM_ALL:
...@@ -343,12 +342,8 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra ...@@ -343,12 +342,8 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
scfp->n_all_wait++; scfp->n_all_wait++;
else else
scfp->n_all++; scfp->n_all++;
if (scfcp) { if (scfcp)
scfcp->scfc_cpu = -1;
scfcp->scfc_wait = true;
scfcp->scfc_out = false;
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);
break; break;
} }
......
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