sched, arch: Create asm/preempt.h
authorPeter Zijlstra <peterz@infradead.org>
Wed, 14 Aug 2013 12:55:40 +0000 (14:55 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 25 Sep 2013 12:07:50 +0000 (14:07 +0200)
In order to prepare to per-arch implementations of preempt_count move
the required bits into an asm-generic header and use this for all
archs.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-h5j0c1r3e3fk015m30h8f1zx@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
32 files changed:
arch/alpha/include/asm/Kbuild
arch/arc/include/asm/Kbuild
arch/arm/include/asm/Kbuild
arch/arm64/include/asm/Kbuild
arch/avr32/include/asm/Kbuild
arch/blackfin/include/asm/Kbuild
arch/c6x/include/asm/Kbuild
arch/cris/include/asm/Kbuild
arch/frv/include/asm/Kbuild
arch/h8300/include/asm/Kbuild
arch/hexagon/include/asm/Kbuild
arch/ia64/include/asm/Kbuild
arch/m32r/include/asm/Kbuild
arch/m68k/include/asm/Kbuild
arch/metag/include/asm/Kbuild
arch/microblaze/include/asm/Kbuild
arch/mips/include/asm/Kbuild
arch/mn10300/include/asm/Kbuild
arch/openrisc/include/asm/Kbuild
arch/parisc/include/asm/Kbuild
arch/powerpc/include/asm/Kbuild
arch/s390/include/asm/Kbuild
arch/score/include/asm/Kbuild
arch/sh/include/asm/Kbuild
arch/sparc/include/asm/Kbuild
arch/tile/include/asm/Kbuild
arch/um/include/asm/Kbuild
arch/unicore32/include/asm/Kbuild
arch/x86/include/asm/Kbuild
arch/xtensa/include/asm/Kbuild
include/asm-generic/preempt.h [new file with mode: 0644]
include/linux/preempt.h

index a6e85f448c1c0f3723eb6e4b91363191d4789b3c..f01fb505ad52ffac8bb98c2619dfd2d7f2c204ab 100644 (file)
@@ -3,3 +3,4 @@ generic-y += clkdev.h
 
 generic-y += exec.h
 generic-y += trace_clock.h
+generic-y += preempt.h
index d8dd660898b9b214927c903e1198e36026513984..5943f7f9d32550313a5ef767e29ead6e64f5e3f6 100644 (file)
@@ -46,3 +46,4 @@ generic-y += ucontext.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += xor.h
+generic-y += preempt.h
index d3db39860b9cc5eb83053f99f9430b926443609c..4e6838d4ddf6d6b30278e3d1feb255339b7ecb33 100644 (file)
@@ -33,3 +33,4 @@ generic-y += timex.h
 generic-y += trace_clock.h
 generic-y += types.h
 generic-y += unaligned.h
+generic-y += preempt.h
index 79a642d199f204247d7232caa69dbb9d78a18a79..519f89f5b6a3de345e05ee79a9d1b66116131e77 100644 (file)
@@ -50,3 +50,4 @@ generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += xor.h
+generic-y += preempt.h
index d22af851f3f638b09fdc4394a05e2cebf8a10201..b946080ee8bb1b40f6788ec0caf35d67cf3b02cf 100644 (file)
@@ -3,3 +3,4 @@ generic-y       += clkdev.h
 generic-y      += exec.h
 generic-y      += trace_clock.h
 generic-y      += param.h
+generic-y += preempt.h
index 127826f8a375ab9d7f6b4d9a9cdd3bed641534f6..f2b43474b0e2f13134b48e860d420b8f144a0a73 100644 (file)
@@ -44,3 +44,4 @@ generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += user.h
 generic-y += xor.h
+generic-y += preempt.h
index e49f918531ad443671b6226a9f0f951f60156b7f..fc0b3c356027d26cbf46cc10ca0fc0056cb4992f 100644 (file)
@@ -56,3 +56,4 @@ generic-y += ucontext.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += xor.h
+generic-y += preempt.h
index c8325455520ef932fcbbb4ce44834d3618568a4e..b06caf649a954a6c1678b192dc947adeed692c5e 100644 (file)
@@ -11,3 +11,4 @@ generic-y += module.h
 generic-y += trace_clock.h
 generic-y += vga.h
 generic-y += xor.h
+generic-y += preempt.h
index c5d76702830603f4d2fbde47e26412c179acfde6..74742dc6a3daabd3ec3a4b2c9c5af03f90d7685c 100644 (file)
@@ -2,3 +2,4 @@
 generic-y += clkdev.h
 generic-y += exec.h
 generic-y += trace_clock.h
+generic-y += preempt.h
index 8ada3cf0c98d8026da5358649facacad1542c80a..7e0e7213a481ee158c41ebdcf196b6f5b1724545 100644 (file)
@@ -6,3 +6,4 @@ generic-y += mmu.h
 generic-y += module.h
 generic-y += trace_clock.h
 generic-y += xor.h
+generic-y += preempt.h
index 1da17caac23c9b353c19b84263905c8c75a1d4d4..67c3450309b7454881d09a162ecb2e5123b4395b 100644 (file)
@@ -53,3 +53,4 @@ generic-y += types.h
 generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += xor.h
+generic-y += preempt.h
index a3456f34f6722ec4d20f20232970182323a9c972..f93ee087e8fe622dcaf9e409910075eb541a73bf 100644 (file)
@@ -3,4 +3,5 @@ generic-y += clkdev.h
 generic-y += exec.h
 generic-y += kvm_para.h
 generic-y += trace_clock.h
+generic-y += preempt.h
 generic-y += vtime.h
\ No newline at end of file
index bebdc36ebb0a85551c19a07f7caacb0155eecb0e..2b58c5f0bc3848ad1d13eb8afc357bebff9484a6 100644 (file)
@@ -3,3 +3,4 @@ generic-y += clkdev.h
 generic-y += exec.h
 generic-y += module.h
 generic-y += trace_clock.h
+generic-y += preempt.h
index 09d77a862da3d961029bdbd260557a33f472523f..a5d27f272a59f105f3b34103fdf8fd6b488c4f2c 100644 (file)
@@ -31,3 +31,4 @@ generic-y += trace_clock.h
 generic-y += types.h
 generic-y += word-at-a-time.h
 generic-y += xor.h
+generic-y += preempt.h
index 6ae0ccb632cb8a8eaa2aee67c219112bf2526f4a..84d0c1d6b9b30fd4afe4f9ad2a38c712154667d2 100644 (file)
@@ -52,3 +52,4 @@ generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += xor.h
+generic-y += preempt.h
index d3c51a6a601dd2017c5ce6a03b86aae95cfe78b7..ce0bbf8f5640e78127f89616188a59be1bb5ba8b 100644 (file)
@@ -3,3 +3,4 @@ generic-y += clkdev.h
 generic-y += exec.h
 generic-y += trace_clock.h
 generic-y += syscalls.h
+generic-y += preempt.h
index 454ddf9bb76f8a5fc5660bc6ab02c4d5380f7593..1acbb8b77a71be49cd16c0967efcac851339f4e3 100644 (file)
@@ -11,5 +11,6 @@ generic-y += sections.h
 generic-y += segment.h
 generic-y += serial.h
 generic-y += trace_clock.h
+generic-y += preempt.h
 generic-y += ucontext.h
 generic-y += xor.h
index c5d76702830603f4d2fbde47e26412c179acfde6..74742dc6a3daabd3ec3a4b2c9c5af03f90d7685c 100644 (file)
@@ -2,3 +2,4 @@
 generic-y += clkdev.h
 generic-y += exec.h
 generic-y += trace_clock.h
+generic-y += preempt.h
index 195653e851da2a460fcafeca692af220bcef58d1..78405625e799016b46647db52711c77f5b7ef224 100644 (file)
@@ -67,3 +67,4 @@ generic-y += ucontext.h
 generic-y += user.h
 generic-y += word-at-a-time.h
 generic-y += xor.h
+generic-y += preempt.h
index ff4c9faed546da39c89d4bd6f1a851376a667040..a603b9ebe54ce38c19328ac936059618771a07c0 100644 (file)
@@ -4,3 +4,4 @@ generic-y += word-at-a-time.h auxvec.h user.h cputime.h emergency-restart.h \
          div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \
          poll.h xor.h clkdev.h exec.h
 generic-y += trace_clock.h
+generic-y += preempt.h
index 704e6f10ae806e0e5702b056cfb4a231542ebfba..d8f9d2f18a23bc932cb4562ac00dc26b1257238b 100644 (file)
@@ -2,4 +2,5 @@
 generic-y += clkdev.h
 generic-y += rwsem.h
 generic-y += trace_clock.h
+generic-y += preempt.h
 generic-y += vtime.h
\ No newline at end of file
index f313f9cbcf44fa410c88e85b17642a865bf39a74..7a5288f3479ae66fe330587516fb6c74240798a2 100644 (file)
@@ -2,3 +2,4 @@
 
 generic-y += clkdev.h
 generic-y += trace_clock.h
+generic-y += preempt.h
index e1c7bb999b06af31fe908089c3ff8e65484e4f82..f3414ade77a37c2628f2fa104efccdd1ec0bbc23 100644 (file)
@@ -4,3 +4,4 @@ header-y +=
 generic-y += clkdev.h
 generic-y += trace_clock.h
 generic-y += xor.h
+generic-y += preempt.h
index 280bea9e5e2be362a7ff32a36cdd966b5f38ffe6..231efbb6810825f636c8cde163ebada4ef783098 100644 (file)
@@ -34,3 +34,4 @@ generic-y += termios.h
 generic-y += trace_clock.h
 generic-y += ucontext.h
 generic-y += xor.h
+generic-y += preempt.h
index 7e4a97fbded412158d845926026987290907902c..bf390667657ae0777365424b4c675fac496e9462 100644 (file)
@@ -16,3 +16,4 @@ generic-y += serial.h
 generic-y += trace_clock.h
 generic-y += types.h
 generic-y += word-at-a-time.h
+generic-y += preempt.h
index 664d6ad23f80626a62e17dbfae3c3b82cd0f6bb0..22f3bd147fa72456dc7a906cd5700acecde6026f 100644 (file)
@@ -38,3 +38,4 @@ generic-y += termios.h
 generic-y += trace_clock.h
 generic-y += types.h
 generic-y += xor.h
+generic-y += preempt.h
index b30f34a79882c4413e77de1495bba161ed61a9af..fdde187e608771c8fa7c5d3a4c37fdbd4d96bdef 100644 (file)
@@ -3,3 +3,4 @@ generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
 generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
 generic-y += switch_to.h clkdev.h
 generic-y += trace_clock.h
+generic-y += preempt.h
index 89d8b6c4e39a09d5739bf215f4ce4c663a9f2ef3..00045cbe5c6336bb9e410e7d9e9bb2ea2bb8ed0c 100644 (file)
@@ -60,3 +60,4 @@ generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += xor.h
+generic-y += preempt.h
index 7f669853317a3e940647319c21705ca951fb18ac..eca20286a91c4c7204bcadb335d0cdb42ada0657 100644 (file)
@@ -5,3 +5,4 @@ genhdr-y += unistd_64.h
 genhdr-y += unistd_x32.h
 
 generic-y += clkdev.h
+generic-y += preempt.h
index 1b982641ec350e35ad0df918ff512da08393279b..228d6aee3a16528f0e5972371e5a1fd6feac9a79 100644 (file)
@@ -28,3 +28,4 @@ generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
 generic-y += xor.h
+generic-y += preempt.h
diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h
new file mode 100644 (file)
index 0000000..a1fc659
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef __ASM_PREEMPT_H
+#define __ASM_PREEMPT_H
+
+#include <linux/thread_info.h>
+
+/*
+ * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
+ * that think a non-zero value indicates we cannot preempt.
+ */
+static __always_inline int preempt_count(void)
+{
+       return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED;
+}
+
+static __always_inline int *preempt_count_ptr(void)
+{
+       return &current_thread_info()->preempt_count;
+}
+
+/*
+ * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the
+ * alternative is loosing a reschedule. Better schedule too often -- also this
+ * should be a very rare operation.
+ */
+static __always_inline void preempt_count_set(int pc)
+{
+       *preempt_count_ptr() = pc;
+}
+
+/*
+ * We fold the NEED_RESCHED bit into the preempt count such that
+ * preempt_enable() can decrement and test for needing to reschedule with a
+ * single instruction.
+ *
+ * We invert the actual bit, so that when the decrement hits 0 we know we both
+ * need to resched (the bit is cleared) and can resched (no preempt count).
+ */
+
+static __always_inline void set_preempt_need_resched(void)
+{
+       *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED;
+}
+
+static __always_inline void clear_preempt_need_resched(void)
+{
+       *preempt_count_ptr() |= PREEMPT_NEED_RESCHED;
+}
+
+static __always_inline bool test_preempt_need_resched(void)
+{
+       return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED);
+}
+
+#endif /* __ASM_PREEMPT_H */
index 92e341853e4b4d6fcf0f45e56180bb7d4ec2bd9a..df8e245e872939d8ce47a821e4f802e70e9ecd1e 100644 (file)
@@ -6,7 +6,6 @@
  * preempt_count (used for kernel preemption, interrupt count, etc.)
  */
 
-#include <linux/thread_info.h>
 #include <linux/linkage.h>
 #include <linux/list.h>
 
  */
 #define PREEMPT_NEED_RESCHED   0x80000000
 
-/*
- * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
- * that think a non-zero value indicates we cannot preempt.
- */
-static __always_inline int preempt_count(void)
-{
-       return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED;
-}
-
-static __always_inline int *preempt_count_ptr(void)
-{
-       return &current_thread_info()->preempt_count;
-}
-
-/*
- * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the
- * alternative is loosing a reschedule. Better schedule too often -- also this
- * should be a very rare operation.
- */
-static __always_inline void preempt_count_set(int pc)
-{
-       *preempt_count_ptr() = pc;
-}
-
-/*
- * We fold the NEED_RESCHED bit into the preempt count such that
- * preempt_enable() can decrement and test for needing to reschedule with a
- * single instruction.
- *
- * We invert the actual bit, so that when the decrement hits 0 we know we both
- * need to resched (the bit is cleared) and can resched (no preempt count).
- */
-
-static __always_inline void set_preempt_need_resched(void)
-{
-       *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED;
-}
-
-static __always_inline void clear_preempt_need_resched(void)
-{
-       *preempt_count_ptr() |= PREEMPT_NEED_RESCHED;
-}
-
-static __always_inline bool test_preempt_need_resched(void)
-{
-       return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED);
-}
+#include <asm/preempt.h>
 
 #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
   extern void add_preempt_count(int val);