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

sched: INIT_PREEMPT_COUNT

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>

authored by

Peter Zijlstra and committed by
Linus Torvalds
c99e6efe 2a6f86bc

+29 -40
+1
arch/alpha/include/asm/thread_info.h
··· 37 37 .task = &tsk, \ 38 38 .exec_domain = &default_exec_domain, \ 39 39 .addr_limit = KERNEL_DS, \ 40 + .preempt_count = INIT_PREEMPT_COUNT, \ 40 41 .restart_block = { \ 41 42 .fn = do_no_restart_syscall, \ 42 43 }, \
+1 -1
arch/arm/include/asm/thread_info.h
··· 73 73 .task = &tsk, \ 74 74 .exec_domain = &default_exec_domain, \ 75 75 .flags = 0, \ 76 - .preempt_count = 1, \ 76 + .preempt_count = INIT_PREEMPT_COUNT, \ 77 77 .addr_limit = KERNEL_DS, \ 78 78 .cpu_domain = domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ 79 79 domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \
+1 -1
arch/avr32/include/asm/thread_info.h
··· 40 40 .exec_domain = &default_exec_domain, \ 41 41 .flags = 0, \ 42 42 .cpu = 0, \ 43 - .preempt_count = 1, \ 43 + .preempt_count = INIT_PREEMPT_COUNT, \ 44 44 .restart_block = { \ 45 45 .fn = do_no_restart_syscall \ 46 46 } \
+1 -1
arch/blackfin/include/asm/thread_info.h
··· 77 77 .exec_domain = &default_exec_domain, \ 78 78 .flags = 0, \ 79 79 .cpu = 0, \ 80 - .preempt_count = 1, \ 80 + .preempt_count = INIT_PREEMPT_COUNT, \ 81 81 .restart_block = { \ 82 82 .fn = do_no_restart_syscall, \ 83 83 }, \
+1 -3
arch/cris/include/asm/thread_info.h
··· 50 50 51 51 /* 52 52 * macros/functions for gaining access to the thread information structure 53 - * 54 - * preempt_count needs to be 1 initially, until the scheduler is functional. 55 53 */ 56 54 #ifndef __ASSEMBLY__ 57 55 #define INIT_THREAD_INFO(tsk) \ ··· 58 60 .exec_domain = &default_exec_domain, \ 59 61 .flags = 0, \ 60 62 .cpu = 0, \ 61 - .preempt_count = 1, \ 63 + .preempt_count = INIT_PREEMPT_COUNT, \ 62 64 .addr_limit = KERNEL_DS, \ 63 65 .restart_block = { \ 64 66 .fn = do_no_restart_syscall, \
+1 -3
arch/frv/include/asm/thread_info.h
··· 56 56 57 57 /* 58 58 * macros/functions for gaining access to the thread information structure 59 - * 60 - * preempt_count needs to be 1 initially, until the scheduler is functional. 61 59 */ 62 60 #ifndef __ASSEMBLY__ 63 61 ··· 65 67 .exec_domain = &default_exec_domain, \ 66 68 .flags = 0, \ 67 69 .cpu = 0, \ 68 - .preempt_count = 1, \ 70 + .preempt_count = INIT_PREEMPT_COUNT, \ 69 71 .addr_limit = KERNEL_DS, \ 70 72 .restart_block = { \ 71 73 .fn = do_no_restart_syscall, \
+1 -1
arch/h8300/include/asm/thread_info.h
··· 36 36 .exec_domain = &default_exec_domain, \ 37 37 .flags = 0, \ 38 38 .cpu = 0, \ 39 - .preempt_count = 1, \ 39 + .preempt_count = INIT_PREEMPT_COUNT, \ 40 40 .restart_block = { \ 41 41 .fn = do_no_restart_syscall, \ 42 42 }, \
+1 -1
arch/ia64/include/asm/thread_info.h
··· 48 48 .flags = 0, \ 49 49 .cpu = 0, \ 50 50 .addr_limit = KERNEL_DS, \ 51 - .preempt_count = 0, \ 51 + .preempt_count = INIT_PREEMPT_COUNT, \ 52 52 .restart_block = { \ 53 53 .fn = do_no_restart_syscall, \ 54 54 }, \
+1 -3
arch/m32r/include/asm/thread_info.h
··· 57 57 58 58 /* 59 59 * macros/functions for gaining access to the thread information structure 60 - * 61 - * preempt_count needs to be 1 initially, until the scheduler is functional. 62 60 */ 63 61 #ifndef __ASSEMBLY__ 64 62 ··· 66 68 .exec_domain = &default_exec_domain, \ 67 69 .flags = 0, \ 68 70 .cpu = 0, \ 69 - .preempt_count = 1, \ 71 + .preempt_count = INIT_PREEMPT_COUNT, \ 70 72 .addr_limit = KERNEL_DS, \ 71 73 .restart_block = { \ 72 74 .fn = do_no_restart_syscall, \
+1
arch/m68k/include/asm/thread_info_mm.h
··· 19 19 { \ 20 20 .task = &tsk, \ 21 21 .exec_domain = &default_exec_domain, \ 22 + .preempt_count = INIT_PREEMPT_COUNT, \ 22 23 .restart_block = { \ 23 24 .fn = do_no_restart_syscall, \ 24 25 }, \
+1
arch/m68k/include/asm/thread_info_no.h
··· 49 49 .exec_domain = &default_exec_domain, \ 50 50 .flags = 0, \ 51 51 .cpu = 0, \ 52 + .preempt_count = INIT_PREEMPT_COUNT, \ 52 53 .restart_block = { \ 53 54 .fn = do_no_restart_syscall, \ 54 55 }, \
+1 -3
arch/microblaze/include/asm/thread_info.h
··· 75 75 76 76 /* 77 77 * macros/functions for gaining access to the thread information structure 78 - * 79 - * preempt_count needs to be 1 initially, until the scheduler is functional. 80 78 */ 81 79 #define INIT_THREAD_INFO(tsk) \ 82 80 { \ ··· 82 84 .exec_domain = &default_exec_domain, \ 83 85 .flags = 0, \ 84 86 .cpu = 0, \ 85 - .preempt_count = 1, \ 87 + .preempt_count = INIT_PREEMPT_COUNT, \ 86 88 .addr_limit = KERNEL_DS, \ 87 89 .restart_block = { \ 88 90 .fn = do_no_restart_syscall, \
+1 -3
arch/mips/include/asm/thread_info.h
··· 39 39 40 40 /* 41 41 * macros/functions for gaining access to the thread information structure 42 - * 43 - * preempt_count needs to be 1 initially, until the scheduler is functional. 44 42 */ 45 43 #define INIT_THREAD_INFO(tsk) \ 46 44 { \ ··· 46 48 .exec_domain = &default_exec_domain, \ 47 49 .flags = _TIF_FIXADE, \ 48 50 .cpu = 0, \ 49 - .preempt_count = 1, \ 51 + .preempt_count = INIT_PREEMPT_COUNT, \ 50 52 .addr_limit = KERNEL_DS, \ 51 53 .restart_block = { \ 52 54 .fn = do_no_restart_syscall, \
+1 -3
arch/mn10300/include/asm/thread_info.h
··· 65 65 66 66 /* 67 67 * macros/functions for gaining access to the thread information structure 68 - * 69 - * preempt_count needs to be 1 initially, until the scheduler is functional. 70 68 */ 71 69 #ifndef __ASSEMBLY__ 72 70 ··· 74 76 .exec_domain = &default_exec_domain, \ 75 77 .flags = 0, \ 76 78 .cpu = 0, \ 77 - .preempt_count = 1, \ 79 + .preempt_count = INIT_PREEMPT_COUNT, \ 78 80 .addr_limit = KERNEL_DS, \ 79 81 .restart_block = { \ 80 82 .fn = do_no_restart_syscall, \
+1 -1
arch/parisc/include/asm/thread_info.h
··· 23 23 .flags = 0, \ 24 24 .cpu = 0, \ 25 25 .addr_limit = KERNEL_DS, \ 26 - .preempt_count = 1, \ 26 + .preempt_count = INIT_PREEMPT_COUNT, \ 27 27 .restart_block = { \ 28 28 .fn = do_no_restart_syscall \ 29 29 } \
+1 -3
arch/powerpc/include/asm/thread_info.h
··· 46 46 47 47 /* 48 48 * macros/functions for gaining access to the thread information structure 49 - * 50 - * preempt_count needs to be 1 initially, until the scheduler is functional. 51 49 */ 52 50 #define INIT_THREAD_INFO(tsk) \ 53 51 { \ 54 52 .task = &tsk, \ 55 53 .exec_domain = &default_exec_domain, \ 56 54 .cpu = 0, \ 57 - .preempt_count = 1, \ 55 + .preempt_count = INIT_PREEMPT_COUNT, \ 58 56 .restart_block = { \ 59 57 .fn = do_no_restart_syscall, \ 60 58 }, \
+1 -1
arch/s390/include/asm/thread_info.h
··· 61 61 .exec_domain = &default_exec_domain, \ 62 62 .flags = 0, \ 63 63 .cpu = 0, \ 64 - .preempt_count = 1, \ 64 + .preempt_count = INIT_PREEMPT_COUNT, \ 65 65 .restart_block = { \ 66 66 .fn = do_no_restart_syscall, \ 67 67 }, \
+1 -1
arch/sh/include/asm/thread_info.h
··· 51 51 .exec_domain = &default_exec_domain, \ 52 52 .flags = 0, \ 53 53 .cpu = 0, \ 54 - .preempt_count = 1, \ 54 + .preempt_count = INIT_PREEMPT_COUNT, \ 55 55 .addr_limit = KERNEL_DS, \ 56 56 .restart_block = { \ 57 57 .fn = do_no_restart_syscall, \
+1 -3
arch/sparc/include/asm/thread_info_32.h
··· 54 54 55 55 /* 56 56 * macros/functions for gaining access to the thread information structure 57 - * 58 - * preempt_count needs to be 1 initially, until the scheduler is functional. 59 57 */ 60 58 #define INIT_THREAD_INFO(tsk) \ 61 59 { \ ··· 62 64 .exec_domain = &default_exec_domain, \ 63 65 .flags = 0, \ 64 66 .cpu = 0, \ 65 - .preempt_count = 1, \ 67 + .preempt_count = INIT_PREEMPT_COUNT, \ 66 68 .restart_block = { \ 67 69 .fn = do_no_restart_syscall, \ 68 70 }, \
+1 -3
arch/sparc/include/asm/thread_info_64.h
··· 125 125 126 126 /* 127 127 * macros/functions for gaining access to the thread information structure 128 - * 129 - * preempt_count needs to be 1 initially, until the scheduler is functional. 130 128 */ 131 129 #ifndef __ASSEMBLY__ 132 130 ··· 133 135 .task = &tsk, \ 134 136 .flags = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT, \ 135 137 .exec_domain = &default_exec_domain, \ 136 - .preempt_count = 1, \ 138 + .preempt_count = INIT_PREEMPT_COUNT, \ 137 139 .restart_block = { \ 138 140 .fn = do_no_restart_syscall, \ 139 141 }, \
+1 -1
arch/um/include/asm/thread_info.h
··· 32 32 .exec_domain = &default_exec_domain, \ 33 33 .flags = 0, \ 34 34 .cpu = 0, \ 35 - .preempt_count = 1, \ 35 + .preempt_count = INIT_PREEMPT_COUNT, \ 36 36 .addr_limit = KERNEL_DS, \ 37 37 .restart_block = { \ 38 38 .fn = do_no_restart_syscall, \
+1 -1
arch/x86/include/asm/thread_info.h
··· 49 49 .exec_domain = &default_exec_domain, \ 50 50 .flags = 0, \ 51 51 .cpu = 0, \ 52 - .preempt_count = 1, \ 52 + .preempt_count = INIT_PREEMPT_COUNT, \ 53 53 .addr_limit = KERNEL_DS, \ 54 54 .restart_block = { \ 55 55 .fn = do_no_restart_syscall, \
+1 -3
arch/xtensa/include/asm/thread_info.h
··· 80 80 81 81 /* 82 82 * macros/functions for gaining access to the thread information structure 83 - * 84 - * preempt_count needs to be 1 initially, until the scheduler is functional. 85 83 */ 86 84 87 85 #ifndef __ASSEMBLY__ ··· 90 92 .exec_domain = &default_exec_domain, \ 91 93 .flags = 0, \ 92 94 .cpu = 0, \ 93 - .preempt_count = 1, \ 95 + .preempt_count = INIT_PREEMPT_COUNT, \ 94 96 .addr_limit = KERNEL_DS, \ 95 97 .restart_block = { \ 96 98 .fn = do_no_restart_syscall, \
+6
include/linux/sched.h
··· 498 498 .sum_exec_runtime = 0, \ 499 499 } 500 500 501 + /* 502 + * Disable preemption until the scheduler is running. 503 + * Reset by start_kernel()->sched_init()->init_idle(). 504 + */ 505 + #define INIT_PREEMPT_COUNT (1) 506 + 501 507 /** 502 508 * struct thread_group_cputimer - thread group interval timer counts 503 509 * @cputime: thread group interval timers.