Skip to content

Commit de7b09e

Browse files
jgross1Ingo Molnar
authored andcommitted
locking/csd_lock: Prepare more CSD lock debugging
In order to be able to easily add more CSD lock debugging data to struct call_function_data->csd move the call_single_data_t element into a sub-structure. Signed-off-by: Juergen Gross <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8d0968c commit de7b09e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

kernel/smp.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131

3232
#define CSD_TYPE(_csd) ((_csd)->node.u_flags & CSD_FLAG_TYPE_MASK)
3333

34+
struct cfd_percpu {
35+
call_single_data_t csd;
36+
};
37+
3438
struct call_function_data {
35-
call_single_data_t __percpu *csd;
39+
struct cfd_percpu __percpu *pcpu;
3640
cpumask_var_t cpumask;
3741
cpumask_var_t cpumask_ipi;
3842
};
@@ -55,8 +59,8 @@ int smpcfd_prepare_cpu(unsigned int cpu)
5559
free_cpumask_var(cfd->cpumask);
5660
return -ENOMEM;
5761
}
58-
cfd->csd = alloc_percpu(call_single_data_t);
59-
if (!cfd->csd) {
62+
cfd->pcpu = alloc_percpu(struct cfd_percpu);
63+
if (!cfd->pcpu) {
6064
free_cpumask_var(cfd->cpumask);
6165
free_cpumask_var(cfd->cpumask_ipi);
6266
return -ENOMEM;
@@ -71,7 +75,7 @@ int smpcfd_dead_cpu(unsigned int cpu)
7175

7276
free_cpumask_var(cfd->cpumask);
7377
free_cpumask_var(cfd->cpumask_ipi);
74-
free_percpu(cfd->csd);
78+
free_percpu(cfd->pcpu);
7579
return 0;
7680
}
7781

@@ -694,7 +698,7 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
694698

695699
cpumask_clear(cfd->cpumask_ipi);
696700
for_each_cpu(cpu, cfd->cpumask) {
697-
call_single_data_t *csd = per_cpu_ptr(cfd->csd, cpu);
701+
call_single_data_t *csd = &per_cpu_ptr(cfd->pcpu, cpu)->csd;
698702

699703
if (cond_func && !cond_func(cpu, info))
700704
continue;
@@ -719,7 +723,7 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
719723
for_each_cpu(cpu, cfd->cpumask) {
720724
call_single_data_t *csd;
721725

722-
csd = per_cpu_ptr(cfd->csd, cpu);
726+
csd = &per_cpu_ptr(cfd->pcpu, cpu)->csd;
723727
csd_lock_wait(csd);
724728
}
725729
}

0 commit comments

Comments
 (0)