Skip to content

Commit e48c15b

Browse files
committed
smp: Add source and destination CPUs to __call_single_data
This commit adds a destination CPU to __call_single_data, and is inspired by an earlier commit by Peter Zijlstra. This version adds #ifdef to permit use by 32-bit systems and supplying the destination CPU for all smp_call_function*() requests, not just smp_call_function_single(). If need be, 32-bit systems could be accommodated by shrinking the flags field to 16 bits (the atomic_t variant is currently unused) and by providing only eight bits for CPU on such systems. It is not clear that the addition of the fields to __call_single_node are really needed. [ paulmck: Apply Boqun Feng feedback on 32-bit builds. ] Link: https://lore.kernel.org/lkml/[email protected]/ Cc: Peter Zijlstra <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Frederic Weisbecker <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 160c7ba commit e48c15b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

include/linux/smp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ struct __call_single_data {
2626
struct {
2727
struct llist_node llist;
2828
unsigned int flags;
29+
#ifdef CONFIG_64BIT
30+
u16 src, dst;
31+
#endif
2932
};
3033
};
3134
smp_call_func_t func;

include/linux/smp_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ struct __call_single_node {
6161
unsigned int u_flags;
6262
atomic_t a_flags;
6363
};
64+
#ifdef CONFIG_64BIT
65+
u16 src, dst;
66+
#endif
6467
};
6568

6669
#endif /* __LINUX_SMP_TYPES_H */

kernel/smp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
375375

376376
csd->func = func;
377377
csd->info = info;
378+
#ifdef CONFIG_64BIT
379+
csd->dst = cpu;
380+
#endif
378381

379382
err = generic_exec_single(cpu, csd);
380383

@@ -540,6 +543,9 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
540543
csd->flags |= CSD_TYPE_SYNC;
541544
csd->func = func;
542545
csd->info = info;
546+
#ifdef CONFIG_64BIT
547+
csd->dst = cpu;
548+
#endif
543549
if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu)))
544550
__cpumask_set_cpu(cpu, cfd->cpumask_ipi);
545551
}

0 commit comments

Comments
 (0)