mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
smp, irq_work: Continue smp_call_function*() and irq_work*() integration
Instead of relying on BUG_ON() to ensure the various data structures line up, use a bunch of horrible unions to make it all automatic. Much of the union magic is to ensure irq_work and smp_call_function do not (yet) see the members of their respective data structures change name. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/20200622100825.844455025@infradead.org
This commit is contained in:
parent
739f70b476
commit
8c4890d1c3
6 changed files with 86 additions and 58 deletions
18
kernel/smp.c
18
kernel/smp.c
|
@ -669,24 +669,6 @@ void __init smp_init(void)
|
|||
{
|
||||
int num_nodes, num_cpus;
|
||||
|
||||
/*
|
||||
* Ensure struct irq_work layout matches so that
|
||||
* flush_smp_call_function_queue() can do horrible things.
|
||||
*/
|
||||
BUILD_BUG_ON(offsetof(struct irq_work, llnode) !=
|
||||
offsetof(struct __call_single_data, llist));
|
||||
BUILD_BUG_ON(offsetof(struct irq_work, func) !=
|
||||
offsetof(struct __call_single_data, func));
|
||||
BUILD_BUG_ON(offsetof(struct irq_work, flags) !=
|
||||
offsetof(struct __call_single_data, flags));
|
||||
|
||||
/*
|
||||
* Assert the CSD_TYPE_TTWU layout is similar enough
|
||||
* for task_struct to be on the @call_single_queue.
|
||||
*/
|
||||
BUILD_BUG_ON(offsetof(struct task_struct, wake_entry_type) - offsetof(struct task_struct, wake_entry) !=
|
||||
offsetof(struct __call_single_data, flags) - offsetof(struct __call_single_data, llist));
|
||||
|
||||
idle_threads_init();
|
||||
cpuhp_threads_init();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue