Commit 351f8f8e6499ae4fff40f5e3a8fe16d9e1903646

Authored by Amerigo Wang
Committed by Linus Torvalds
1 parent b8cb464e4a

kernel: clean up USE_GENERIC_SMP_HELPERS

For arch which needs USE_GENERIC_SMP_HELPERS, it has to select
USE_GENERIC_SMP_HELPERS, rather than leaving a choice to user, since they
don't provide their own implementions.

Also, move on_each_cpu() to kernel/smp.c, it is strange to put it in
kernel/softirq.c.

For arch which doesn't use USE_GENERIC_SMP_HELPERS, e.g.  blackfin, only
on_each_cpu() is compiled.

Signed-off-by: Amerigo Wang <amwang@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 5 changed files with 22 additions and 29 deletions Side-by-side Diff

arch/mn10300/Kconfig
... ... @@ -203,6 +203,7 @@
203 203 config SMP
204 204 bool "Symmetric multi-processing support"
205 205 default y
  206 + select USE_GENERIC_SMP_HELPERS
206 207 depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050
207 208 ---help---
208 209 This enables support for systems with more than one CPU. If you have
... ... @@ -225,11 +226,6 @@
225 226 int
226 227 depends on SMP
227 228 default "2"
228   -
229   -config USE_GENERIC_SMP_HELPERS
230   - bool
231   - depends on SMP
232   - default y
233 229  
234 230 source "kernel/Kconfig.preempt"
235 231  
... ... @@ -65,6 +65,7 @@
65 65 select HAVE_SPARSE_IRQ
66 66 select GENERIC_IRQ_PROBE
67 67 select GENERIC_PENDING_IRQ if SMP
  68 + select USE_GENERIC_SMP_HELPERS if SMP
68 69  
69 70 config INSTRUCTION_DECODER
70 71 def_bool (KPROBES || PERF_EVENTS)
... ... @@ -202,10 +203,6 @@
202 203 config HAVE_INTEL_TXT
203 204 def_bool y
204 205 depends on EXPERIMENTAL && DMAR && ACPI
205   -
206   -config USE_GENERIC_SMP_HELPERS
207   - def_bool y
208   - depends on SMP
209 206  
210 207 config X86_32_SMP
211 208 def_bool y
... ... @@ -43,7 +43,7 @@
43 43 obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
44 44 obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
45 45 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
46   -obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
  46 +obj-$(CONFIG_SMP) += smp.o
47 47 ifneq ($(CONFIG_SMP),y)
48 48 obj-y += up.o
49 49 endif
... ... @@ -13,6 +13,7 @@
13 13 #include <linux/smp.h>
14 14 #include <linux/cpu.h>
15 15  
  16 +#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
16 17 static struct {
17 18 struct list_head queue;
18 19 raw_spinlock_t lock;
... ... @@ -529,4 +530,22 @@
529 530 {
530 531 raw_spin_unlock_irq(&call_function.lock);
531 532 }
  533 +#endif /* USE_GENERIC_SMP_HELPERS */
  534 +
  535 +/*
  536 + * Call a function on all processors
  537 + */
  538 +int on_each_cpu(void (*func) (void *info), void *info, int wait)
  539 +{
  540 + int ret = 0;
  541 +
  542 + preempt_disable();
  543 + ret = smp_call_function(func, info, wait);
  544 + local_irq_disable();
  545 + func(info);
  546 + local_irq_enable();
  547 + preempt_enable();
  548 + return ret;
  549 +}
  550 +EXPORT_SYMBOL(on_each_cpu);
... ... @@ -885,25 +885,6 @@
885 885 }
886 886 early_initcall(spawn_ksoftirqd);
887 887  
888   -#ifdef CONFIG_SMP
889   -/*
890   - * Call a function on all processors
891   - */
892   -int on_each_cpu(void (*func) (void *info), void *info, int wait)
893   -{
894   - int ret = 0;
895   -
896   - preempt_disable();
897   - ret = smp_call_function(func, info, wait);
898   - local_irq_disable();
899   - func(info);
900   - local_irq_enable();
901   - preempt_enable();
902   - return ret;
903   -}
904   -EXPORT_SYMBOL(on_each_cpu);
905   -#endif
906   -
907 888 /*
908 889 * [ These __weak aliases are kept in a separate compilation unit, so that
909 890 * GCC does not inline them incorrectly. ]