Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] smp/idle: call init_idle() before starting a new cpu

Call init_idle() which (re-)initializes the idle task structure before
it gets used on a new cpu.
That way we can also get rid of the odd preempt_enable_no_resched()
call we have in the cpu offline path within cpu_idle(). That call
prevented preempt count imbalances between cpu hotplug operations.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
da7f51c1 f230886b

+5 -7
+2 -1
arch/s390/include/asm/smp.h
··· 20 20 21 21 extern int __cpu_disable (void); 22 22 extern void __cpu_die (unsigned int cpu); 23 - extern void cpu_die (void) __attribute__ ((noreturn)); 24 23 extern int __cpu_up (unsigned int cpu); 25 24 26 25 extern struct mutex smp_cpu_state_mutex; ··· 70 71 71 72 #ifdef CONFIG_HOTPLUG_CPU 72 73 extern int smp_rescan_cpus(void); 74 + extern void __noreturn cpu_die(void); 73 75 #else 74 76 static inline int smp_rescan_cpus(void) { return 0; } 77 + static inline void cpu_die(void) { } 75 78 #endif 76 79 77 80 #endif /* __ASM_SMP_H */
+2 -6
arch/s390/kernel/process.c
··· 42 42 #include <asm/irq.h> 43 43 #include <asm/timer.h> 44 44 #include <asm/nmi.h> 45 + #include <asm/smp.h> 45 46 #include "entry.h" 46 47 47 48 asmlinkage void ret_from_fork(void) asm ("ret_from_fork"); ··· 77 76 */ 78 77 static void default_idle(void) 79 78 { 80 - /* CPU is going idle. */ 81 - #ifdef CONFIG_HOTPLUG_CPU 82 - if (cpu_is_offline(smp_processor_id())) { 83 - preempt_enable_no_resched(); 79 + if (cpu_is_offline(smp_processor_id())) 84 80 cpu_die(); 85 - } 86 - #endif 87 81 local_irq_disable(); 88 82 if (need_resched()) { 89 83 local_irq_enable();
+1
arch/s390/kernel/smp.c
··· 575 575 idle = c_idle.idle; 576 576 current_set[cpu] = c_idle.idle; 577 577 } 578 + init_idle(idle, cpu); 578 579 if (smp_alloc_lowcore(cpu)) 579 580 return -ENOMEM; 580 581 do {