sched: INIT_PREEMPT_COUNT
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 10 Jul 2009 12:57:56 +0000 (14:57 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Jul 2009 21:24:05 +0000 (14:24 -0700)
Pull the initial preempt_count value into a single
definition site.

Maintainers for: alpha, ia64 and m68k, please have a look,
your arch code is funny.

The header magic is a bit odd, but similar to the KERNEL_DS
one, CPP waits with expanding these macros until the
INIT_THREAD_INFO macro itself is expanded, which is in
arch/*/kernel/init_task.c where we've already included
sched.h so we're good.

Cc: tony.luck@intel.com
Cc: rth@twiddle.net
Cc: geert@linux-m68k.org
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24 files changed:
arch/alpha/include/asm/thread_info.h
arch/arm/include/asm/thread_info.h
arch/avr32/include/asm/thread_info.h
arch/blackfin/include/asm/thread_info.h
arch/cris/include/asm/thread_info.h
arch/frv/include/asm/thread_info.h
arch/h8300/include/asm/thread_info.h
arch/ia64/include/asm/thread_info.h
arch/m32r/include/asm/thread_info.h
arch/m68k/include/asm/thread_info_mm.h
arch/m68k/include/asm/thread_info_no.h
arch/microblaze/include/asm/thread_info.h
arch/mips/include/asm/thread_info.h
arch/mn10300/include/asm/thread_info.h
arch/parisc/include/asm/thread_info.h
arch/powerpc/include/asm/thread_info.h
arch/s390/include/asm/thread_info.h
arch/sh/include/asm/thread_info.h
arch/sparc/include/asm/thread_info_32.h
arch/sparc/include/asm/thread_info_64.h
arch/um/include/asm/thread_info.h
arch/x86/include/asm/thread_info.h
arch/xtensa/include/asm/thread_info.h
include/linux/sched.h

index d069526..60c83ab 100644 (file)
@@ -37,6 +37,7 @@ struct thread_info {
        .task           = &tsk,                 \
        .exec_domain    = &default_exec_domain, \
        .addr_limit     = KERNEL_DS,            \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
        },                                      \
index 4f88482..73394e5 100644 (file)
@@ -73,7 +73,7 @@ struct thread_info {
        .task           = &tsk,                                         \
        .exec_domain    = &default_exec_domain,                         \
        .flags          = 0,                                            \
-       .preempt_count  = 1,                                            \
+       .preempt_count  = INIT_PREEMPT_COUNT,                           \
        .addr_limit     = KERNEL_DS,                                    \
        .cpu_domain     = domain_val(DOMAIN_USER, DOMAIN_MANAGER) |     \
                          domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) |   \
index 4442f8d..fc42de5 100644 (file)
@@ -40,7 +40,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain,                         \
        .flags          = 0,                                            \
        .cpu            = 0,                                            \
-       .preempt_count  = 1,                                            \
+       .preempt_count  = INIT_PREEMPT_COUNT,                           \
        .restart_block  = {                                             \
                .fn     = do_no_restart_syscall                         \
        }                                                               \
index 2920087..2bbfdd9 100644 (file)
@@ -77,7 +77,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .restart_block  = {                     \
                .fn = do_no_restart_syscall,    \
        },                                      \
index bc5b293..c3aade3 100644 (file)
@@ -50,8 +50,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #ifndef __ASSEMBLY__
 #define INIT_THREAD_INFO(tsk)                          \
@@ -60,7 +58,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain,         \
        .flags          = 0,                            \
        .cpu            = 0,                            \
-       .preempt_count  = 1,                            \
+       .preempt_count  = INIT_PREEMPT_COUNT,           \
        .addr_limit     = KERNEL_DS,                    \
        .restart_block = {                              \
                       .fn = do_no_restart_syscall,     \
index e8a5ed7..e608e05 100644 (file)
@@ -56,8 +56,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #ifndef __ASSEMBLY__
 
@@ -67,7 +65,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
index 700014d..8bbc8b0 100644 (file)
@@ -36,7 +36,7 @@ struct thread_info {
        .exec_domain =  &default_exec_domain,   \
        .flags =        0,                      \
        .cpu =          0,                      \
-       .preempt_count = 1,                     \
+       .preempt_count = INIT_PREEMPT_COUNT,    \
        .restart_block  = {                     \
                .fn = do_no_restart_syscall,    \
        },                                      \
index ae69226..8ce2e38 100644 (file)
@@ -48,7 +48,7 @@ struct thread_info {
        .flags          = 0,                    \
        .cpu            = 0,                    \
        .addr_limit     = KERNEL_DS,            \
-       .preempt_count  = 0,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
        },                                      \
index 8589d46..07bb5bd 100644 (file)
@@ -57,8 +57,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #ifndef __ASSEMBLY__
 
@@ -68,7 +66,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
index af0fda4..6ea5c33 100644 (file)
@@ -19,6 +19,7 @@ struct thread_info {
 {                                              \
        .task           = &tsk,                 \
        .exec_domain    = &default_exec_domain, \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
        },                                      \
index 82529f4..c2bde5e 100644 (file)
@@ -49,6 +49,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .restart_block  = {                     \
                .fn = do_no_restart_syscall,    \
        },                                      \
index 7fac444..6e92885 100644 (file)
@@ -75,8 +75,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #define INIT_THREAD_INFO(tsk)                  \
 {                                              \
@@ -84,7 +82,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
index 143a481..f9df720 100644 (file)
@@ -39,8 +39,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #define INIT_THREAD_INFO(tsk)                  \
 {                                              \
@@ -48,7 +46,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = _TIF_FIXADE,          \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block  = {                     \
                .fn = do_no_restart_syscall,    \
index 78a3881..58d64f8 100644 (file)
@@ -65,8 +65,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #ifndef __ASSEMBLY__
 
@@ -76,7 +74,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
index 0407959..4ce0edf 100644 (file)
@@ -23,7 +23,7 @@ struct thread_info {
        .flags          = 0,                    \
        .cpu            = 0,                    \
        .addr_limit     = KERNEL_DS,            \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .restart_block  = {                     \
                .fn = do_no_restart_syscall     \
        }                                       \
index 9aba5a3..c8b3292 100644 (file)
@@ -46,15 +46,13 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #define INIT_THREAD_INFO(tsk)                  \
 {                                              \
        .task =         &tsk,                   \
        .exec_domain =  &default_exec_domain,   \
        .cpu =          0,                      \
-       .preempt_count = 1,                     \
+       .preempt_count = INIT_PREEMPT_COUNT,    \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
        },                                      \
index 925bcc6..ba1cab9 100644 (file)
@@ -61,7 +61,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .restart_block  = {                     \
                .fn = do_no_restart_syscall,    \
        },                                      \
index f09ac48..d570ac2 100644 (file)
@@ -51,7 +51,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block  = {                     \
                .fn = do_no_restart_syscall,    \
index 0f7b0e5..844d73a 100644 (file)
@@ -54,8 +54,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #define INIT_THREAD_INFO(tsk)                          \
 {                                                      \
@@ -64,7 +62,7 @@ struct thread_info {
        .exec_domain    =       &default_exec_domain,   \
        .flags          =       0,                      \
        .cpu            =       0,                      \
-       .preempt_count  =       1,                      \
+       .preempt_count  =       INIT_PREEMPT_COUNT,     \
        .restart_block  = {                             \
                .fn     =       do_no_restart_syscall,  \
        },                                              \
index 6586572..1b45a7b 100644 (file)
@@ -125,8 +125,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 #ifndef __ASSEMBLY__
 
@@ -135,7 +133,7 @@ struct thread_info {
        .task           =       &tsk,                   \
        .flags          = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT,   \
        .exec_domain    =       &default_exec_domain,   \
-       .preempt_count  =       1,                      \
+       .preempt_count  =       INIT_PREEMPT_COUNT,     \
        .restart_block  = {                             \
                .fn     =       do_no_restart_syscall,  \
        },                                              \
index 62274ab..fd911f8 100644 (file)
@@ -32,7 +32,7 @@ struct thread_info {
        .exec_domain =  &default_exec_domain,   \
        .flags =                0,              \
        .cpu =          0,                      \
-       .preempt_count =        1,              \
+       .preempt_count = INIT_PREEMPT_COUNT,    \
        .addr_limit =   KERNEL_DS,              \
        .restart_block =  {                     \
                .fn =  do_no_restart_syscall,   \
index b078352..fad7d40 100644 (file)
@@ -49,7 +49,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
index 0f4fe1f..1316564 100644 (file)
@@ -80,8 +80,6 @@ struct thread_info {
 
 /*
  * macros/functions for gaining access to the thread information structure
- *
- * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
 
 #ifndef __ASSEMBLY__
@@ -92,7 +90,7 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .flags          = 0,                    \
        .cpu            = 0,                    \
-       .preempt_count  = 1,                    \
+       .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
        .restart_block = {                      \
                .fn = do_no_restart_syscall,    \
index 0085d75..2a99f1c 100644 (file)
@@ -498,6 +498,12 @@ struct task_cputime {
                .sum_exec_runtime = 0,                          \
        }
 
+/*
+ * Disable preemption until the scheduler is running.
+ * Reset by start_kernel()->sched_init()->init_idle().
+ */
+#define INIT_PREEMPT_COUNT     (1)
+
 /**
  * struct thread_group_cputimer - thread group interval timer counts
  * @cputime:           thread group interval timers.