diff options
| author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-07-25 04:45:40 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:28 -0400 |
| commit | b69c49b78457f681ecfb3147bd968434ee6559c1 (patch) | |
| tree | 9557c950c21cf4336ccc403136ea11384150af31 | |
| parent | 62ec30d45ecbb85b5991474c8f04192697687495 (diff) | |
clean up duplicated alloc/free_thread_info
We duplicate alloc/free_thread_info defines on many platforms (the
majority uses __get_free_pages/free_pages). This patch defines common
defines and removes these duplicated defines.
__HAVE_ARCH_THREAD_INFO_ALLOCATOR is introduced for platforms that do
something different.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | include/asm-alpha/thread_info.h | 4 | ||||
| -rw-r--r-- | include/asm-arm/thread_info.h | 13 | ||||
| -rw-r--r-- | include/asm-avr32/thread_info.h | 4 | ||||
| -rw-r--r-- | include/asm-blackfin/thread_info.h | 5 | ||||
| -rw-r--r-- | include/asm-cris/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-frv/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-h8300/thread_info.h | 5 | ||||
| -rw-r--r-- | include/asm-ia64/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-m32r/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-m68k/thread_info.h | 8 | ||||
| -rw-r--r-- | include/asm-m68knommu/thread_info.h | 4 | ||||
| -rw-r--r-- | include/asm-mips/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-mn10300/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-parisc/thread_info.h | 10 | ||||
| -rw-r--r-- | include/asm-powerpc/thread_info.h | 14 | ||||
| -rw-r--r-- | include/asm-s390/thread_info.h | 5 | ||||
| -rw-r--r-- | include/asm-sh/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc/thread_info_32.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc/thread_info_64.h | 2 | ||||
| -rw-r--r-- | include/asm-um/thread_info.h | 16 | ||||
| -rw-r--r-- | include/asm-x86/thread_info.h | 2 | ||||
| -rw-r--r-- | include/asm-xtensa/thread_info.h | 5 | ||||
| -rw-r--r-- | kernel/fork.c | 17 |
23 files changed, 50 insertions, 80 deletions
diff --git a/include/asm-alpha/thread_info.h b/include/asm-alpha/thread_info.h index fb318519629..15fda434442 100644 --- a/include/asm-alpha/thread_info.h +++ b/include/asm-alpha/thread_info.h | |||
| @@ -50,10 +50,8 @@ register struct thread_info *__current_thread_info __asm__("$8"); | |||
| 50 | #define current_thread_info() __current_thread_info | 50 | #define current_thread_info() __current_thread_info |
| 51 | 51 | ||
| 52 | /* Thread information allocation. */ | 52 | /* Thread information allocation. */ |
| 53 | #define THREAD_SIZE_ORDER 1 | ||
| 53 | #define THREAD_SIZE (2*PAGE_SIZE) | 54 | #define THREAD_SIZE (2*PAGE_SIZE) |
| 54 | #define alloc_thread_info(tsk) \ | ||
| 55 | ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) | ||
| 56 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
| 57 | 55 | ||
| 58 | #endif /* __ASSEMBLY__ */ | 56 | #endif /* __ASSEMBLY__ */ |
| 59 | 57 | ||
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h index f5a66478631..d4be2d64616 100644 --- a/include/asm-arm/thread_info.h +++ b/include/asm-arm/thread_info.h | |||
| @@ -97,19 +97,6 @@ static inline struct thread_info *current_thread_info(void) | |||
| 97 | return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); | 97 | return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /* thread information allocation */ | ||
| 101 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
| 102 | #define alloc_thread_info(tsk) \ | ||
| 103 | ((struct thread_info *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, \ | ||
| 104 | THREAD_SIZE_ORDER)) | ||
| 105 | #else | ||
| 106 | #define alloc_thread_info(tsk) \ | ||
| 107 | ((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER)) | ||
| 108 | #endif | ||
| 109 | |||
| 110 | #define free_thread_info(info) \ | ||
| 111 | free_pages((unsigned long)info, THREAD_SIZE_ORDER); | ||
| 112 | |||
| 113 | #define thread_saved_pc(tsk) \ | 100 | #define thread_saved_pc(tsk) \ |
| 114 | ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) | 101 | ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) |
| 115 | #define thread_saved_fp(tsk) \ | 102 | #define thread_saved_fp(tsk) \ |
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h index df68631b7b2..294b25f9323 100644 --- a/include/asm-avr32/thread_info.h +++ b/include/asm-avr32/thread_info.h | |||
| @@ -61,10 +61,6 @@ static inline struct thread_info *current_thread_info(void) | |||
| 61 | return (struct thread_info *)addr; | 61 | return (struct thread_info *)addr; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /* thread information allocation */ | ||
| 65 | #define alloc_thread_info(ti) \ | ||
| 66 | ((struct thread_info *) __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER)) | ||
| 67 | #define free_thread_info(ti) free_pages((unsigned long)(ti), 1) | ||
| 68 | #define get_thread_info(ti) get_task_struct((ti)->task) | 64 | #define get_thread_info(ti) get_task_struct((ti)->task) |
| 69 | #define put_thread_info(ti) put_task_struct((ti)->task) | 65 | #define put_thread_info(ti) put_task_struct((ti)->task) |
| 70 | 66 | ||
diff --git a/include/asm-blackfin/thread_info.h b/include/asm-blackfin/thread_info.h index bc2fe5accf2..642769329d1 100644 --- a/include/asm-blackfin/thread_info.h +++ b/include/asm-blackfin/thread_info.h | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | /* | 42 | /* |
| 43 | * Size of kernel stack for each process. This must be a power of 2... | 43 | * Size of kernel stack for each process. This must be a power of 2... |
| 44 | */ | 44 | */ |
| 45 | #define THREAD_SIZE_ORDER 1 | ||
| 45 | #define THREAD_SIZE 8192 /* 2 pages */ | 46 | #define THREAD_SIZE 8192 /* 2 pages */ |
| 46 | 47 | ||
| 47 | #ifndef __ASSEMBLY__ | 48 | #ifndef __ASSEMBLY__ |
| @@ -94,10 +95,6 @@ static inline struct thread_info *current_thread_info(void) | |||
| 94 | return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1)); | 95 | return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1)); |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | /* thread information allocation */ | ||
| 98 | #define alloc_thread_info(tsk) ((struct thread_info *) \ | ||
| 99 | __get_free_pages(GFP_KERNEL, 1)) | ||
| 100 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
| 101 | #endif /* __ASSEMBLY__ */ | 98 | #endif /* __ASSEMBLY__ */ |
| 102 | 99 | ||
| 103 | /* | 100 | /* |
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h index 784668ab0fa..7efe1000f99 100644 --- a/include/asm-cris/thread_info.h +++ b/include/asm-cris/thread_info.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | 11 | ||
| 12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
| 13 | 13 | ||
| 14 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 15 | |||
| 14 | #ifndef __ASSEMBLY__ | 16 | #ifndef __ASSEMBLY__ |
| 15 | #include <asm/types.h> | 17 | #include <asm/types.h> |
| 16 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h index 348b8f1df17..b7ac6bf2844 100644 --- a/include/asm-frv/thread_info.h +++ b/include/asm-frv/thread_info.h | |||
| @@ -82,6 +82,8 @@ register struct thread_info *__current_thread_info asm("gr15"); | |||
| 82 | 82 | ||
| 83 | #define current_thread_info() ({ __current_thread_info; }) | 83 | #define current_thread_info() ({ __current_thread_info; }) |
| 84 | 84 | ||
| 85 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 86 | |||
| 85 | /* thread information allocation */ | 87 | /* thread information allocation */ |
| 86 | #ifdef CONFIG_DEBUG_STACK_USAGE | 88 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 87 | #define alloc_thread_info(tsk) \ | 89 | #define alloc_thread_info(tsk) \ |
diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h index 27bb95e2944..aafd4d322ec 100644 --- a/include/asm-h8300/thread_info.h +++ b/include/asm-h8300/thread_info.h | |||
| @@ -49,6 +49,7 @@ struct thread_info { | |||
| 49 | /* | 49 | /* |
| 50 | * Size of kernel stack for each process. This must be a power of 2... | 50 | * Size of kernel stack for each process. This must be a power of 2... |
| 51 | */ | 51 | */ |
| 52 | #define THREAD_SIZE_ORDER 1 | ||
| 52 | #define THREAD_SIZE 8192 /* 2 pages */ | 53 | #define THREAD_SIZE 8192 /* 2 pages */ |
| 53 | 54 | ||
| 54 | 55 | ||
| @@ -65,10 +66,6 @@ static inline struct thread_info *current_thread_info(void) | |||
| 65 | return ti; | 66 | return ti; |
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | /* thread information allocation */ | ||
| 69 | #define alloc_thread_info(tsk) ((struct thread_info *) \ | ||
| 70 | __get_free_pages(GFP_KERNEL, 1)) | ||
| 71 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
| 72 | #endif /* __ASSEMBLY__ */ | 69 | #endif /* __ASSEMBLY__ */ |
| 73 | 70 | ||
| 74 | /* | 71 | /* |
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 2422ac61658..7c60fcdd2ef 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h | |||
| @@ -54,6 +54,8 @@ struct thread_info { | |||
| 54 | }, \ | 54 | }, \ |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 58 | |||
| 57 | #ifndef ASM_OFFSETS_C | 59 | #ifndef ASM_OFFSETS_C |
| 58 | /* how to get the thread information struct from C */ | 60 | /* how to get the thread information struct from C */ |
| 59 | #define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE)) | 61 | #define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE)) |
diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h index 1effcd0f5e6..8589d462df2 100644 --- a/include/asm-m32r/thread_info.h +++ b/include/asm-m32r/thread_info.h | |||
| @@ -94,6 +94,8 @@ static inline struct thread_info *current_thread_info(void) | |||
| 94 | return ti; | 94 | return ti; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 98 | |||
| 97 | /* thread information allocation */ | 99 | /* thread information allocation */ |
| 98 | #ifdef CONFIG_DEBUG_STACK_USAGE | 100 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 99 | #define alloc_thread_info(tsk) \ | 101 | #define alloc_thread_info(tsk) \ |
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h index d635a375248..abc002798a2 100644 --- a/include/asm-m68k/thread_info.h +++ b/include/asm-m68k/thread_info.h | |||
| @@ -25,13 +25,7 @@ struct thread_info { | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | /* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */ | 27 | /* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */ |
| 28 | #if PAGE_SHIFT == 13 /* 8k machines */ | 28 | #define THREAD_SIZE_ORDER (13 - PAGE_SHIFT) |
| 29 | #define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,0)) | ||
| 30 | #define free_thread_info(ti) free_pages((unsigned long)(ti),0) | ||
| 31 | #else /* otherwise assume 4k pages */ | ||
| 32 | #define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,1)) | ||
| 33 | #define free_thread_info(ti) free_pages((unsigned long)(ti),1) | ||
| 34 | #endif /* PAGE_SHIFT == 13 */ | ||
| 35 | 29 | ||
| 36 | #define init_thread_info (init_task.thread.info) | 30 | #define init_thread_info (init_task.thread.info) |
| 37 | #define init_stack (init_thread_union.stack) | 31 | #define init_stack (init_thread_union.stack) |
diff --git a/include/asm-m68knommu/thread_info.h b/include/asm-m68knommu/thread_info.h index 95996d978be..0c9bc095f3f 100644 --- a/include/asm-m68knommu/thread_info.h +++ b/include/asm-m68knommu/thread_info.h | |||
| @@ -71,10 +71,6 @@ static inline struct thread_info *current_thread_info(void) | |||
| 71 | return ti; | 71 | return ti; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | /* thread information allocation */ | ||
| 75 | #define alloc_thread_info(tsk) ((struct thread_info *) \ | ||
| 76 | __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER)) | ||
| 77 | #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_SIZE_ORDER) | ||
| 78 | #endif /* __ASSEMBLY__ */ | 74 | #endif /* __ASSEMBLY__ */ |
| 79 | 75 | ||
| 80 | #define PREEMPT_ACTIVE 0x4000000 | 76 | #define PREEMPT_ACTIVE 0x4000000 |
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h index b2772df1a1b..bb3060699df 100644 --- a/include/asm-mips/thread_info.h +++ b/include/asm-mips/thread_info.h | |||
| @@ -82,6 +82,8 @@ register struct thread_info *__current_thread_info __asm__("$28"); | |||
| 82 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) | 82 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
| 83 | #define THREAD_MASK (THREAD_SIZE - 1UL) | 83 | #define THREAD_MASK (THREAD_SIZE - 1UL) |
| 84 | 84 | ||
| 85 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 86 | |||
| 85 | #ifdef CONFIG_DEBUG_STACK_USAGE | 87 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 86 | #define alloc_thread_info(tsk) \ | 88 | #define alloc_thread_info(tsk) \ |
| 87 | ({ \ | 89 | ({ \ |
diff --git a/include/asm-mn10300/thread_info.h b/include/asm-mn10300/thread_info.h index e397e719278..78a3881f3c1 100644 --- a/include/asm-mn10300/thread_info.h +++ b/include/asm-mn10300/thread_info.h | |||
| @@ -112,6 +112,8 @@ static inline unsigned long current_stack_pointer(void) | |||
| 112 | return sp; | 112 | return sp; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 116 | |||
| 115 | /* thread information allocation */ | 117 | /* thread information allocation */ |
| 116 | #ifdef CONFIG_DEBUG_STACK_USAGE | 118 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 117 | #define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL) | 119 | #define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL) |
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h index 2d9c7500867..9f812741c35 100644 --- a/include/asm-parisc/thread_info.h +++ b/include/asm-parisc/thread_info.h | |||
| @@ -34,15 +34,11 @@ struct thread_info { | |||
| 34 | 34 | ||
| 35 | /* thread information allocation */ | 35 | /* thread information allocation */ |
| 36 | 36 | ||
| 37 | #define THREAD_ORDER 2 | 37 | #define THREAD_SIZE_ORDER 2 |
| 38 | /* Be sure to hunt all references to this down when you change the size of | 38 | /* Be sure to hunt all references to this down when you change the size of |
| 39 | * the kernel stack */ | 39 | * the kernel stack */ |
| 40 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | 40 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
| 41 | #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER) | 41 | #define THREAD_SHIFT (PAGE_SHIFT + THREAD_SIZE_ORDER) |
| 42 | |||
| 43 | #define alloc_thread_info(tsk) ((struct thread_info *) \ | ||
| 44 | __get_free_pages(GFP_KERNEL, THREAD_ORDER)) | ||
| 45 | #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) | ||
| 46 | 42 | ||
| 47 | /* how to get the thread information struct from C */ | 43 | /* how to get the thread information struct from C */ |
| 48 | #define current_thread_info() ((struct thread_info *)mfctl(30)) | 44 | #define current_thread_info() ((struct thread_info *)mfctl(30)) |
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h index b705c2a7651..a9db562df69 100644 --- a/include/asm-powerpc/thread_info.h +++ b/include/asm-powerpc/thread_info.h | |||
| @@ -66,20 +66,12 @@ struct thread_info { | |||
| 66 | 66 | ||
| 67 | #if THREAD_SHIFT >= PAGE_SHIFT | 67 | #if THREAD_SHIFT >= PAGE_SHIFT |
| 68 | 68 | ||
| 69 | #define THREAD_ORDER (THREAD_SHIFT - PAGE_SHIFT) | 69 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) |
| 70 | |||
| 71 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
| 72 | #define alloc_thread_info(tsk) \ | ||
| 73 | ((struct thread_info *)__get_free_pages(GFP_KERNEL | \ | ||
| 74 | __GFP_ZERO, THREAD_ORDER)) | ||
| 75 | #else | ||
| 76 | #define alloc_thread_info(tsk) \ | ||
| 77 | ((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_ORDER)) | ||
| 78 | #endif | ||
| 79 | #define free_thread_info(ti) free_pages((unsigned long)ti, THREAD_ORDER) | ||
| 80 | 70 | ||
| 81 | #else /* THREAD_SHIFT < PAGE_SHIFT */ | 71 | #else /* THREAD_SHIFT < PAGE_SHIFT */ |
| 82 | 72 | ||
| 73 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 74 | |||
| 83 | extern struct thread_info *alloc_thread_info(struct task_struct *tsk); | 75 | extern struct thread_info *alloc_thread_info(struct task_struct *tsk); |
| 84 | extern void free_thread_info(struct thread_info *ti); | 76 | extern void free_thread_info(struct thread_info *ti); |
| 85 | 77 | ||
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h index 99bbed99a3b..91a8f93ad35 100644 --- a/include/asm-s390/thread_info.h +++ b/include/asm-s390/thread_info.h | |||
| @@ -78,10 +78,7 @@ static inline struct thread_info *current_thread_info(void) | |||
| 78 | return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE); | 78 | return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /* thread information allocation */ | 81 | #define THREAD_SIZE_ORDER THREAD_ORDER |
| 82 | #define alloc_thread_info(tsk) ((struct thread_info *) \ | ||
| 83 | __get_free_pages(GFP_KERNEL,THREAD_ORDER)) | ||
| 84 | #define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER) | ||
| 85 | 82 | ||
| 86 | #endif | 83 | #endif |
| 87 | 84 | ||
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h index c50e5d35fe8..5131e390752 100644 --- a/include/asm-sh/thread_info.h +++ b/include/asm-sh/thread_info.h | |||
| @@ -92,6 +92,8 @@ static inline struct thread_info *current_thread_info(void) | |||
| 92 | return ti; | 92 | return ti; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 96 | |||
| 95 | /* thread information allocation */ | 97 | /* thread information allocation */ |
| 96 | #ifdef CONFIG_DEBUG_STACK_USAGE | 98 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 97 | #define alloc_thread_info(ti) kzalloc(THREAD_SIZE, GFP_KERNEL) | 99 | #define alloc_thread_info(ti) kzalloc(THREAD_SIZE, GFP_KERNEL) |
diff --git a/include/asm-sparc/thread_info_32.h b/include/asm-sparc/thread_info_32.h index 91b9f5888c8..2cf9db04405 100644 --- a/include/asm-sparc/thread_info_32.h +++ b/include/asm-sparc/thread_info_32.h | |||
| @@ -86,6 +86,8 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
| 86 | #define THREAD_INFO_ORDER 1 | 86 | #define THREAD_INFO_ORDER 1 |
| 87 | #endif | 87 | #endif |
| 88 | 88 | ||
| 89 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 90 | |||
| 89 | BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void) | 91 | BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void) |
| 90 | #define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)() | 92 | #define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)() |
| 91 | 93 | ||
diff --git a/include/asm-sparc/thread_info_64.h b/include/asm-sparc/thread_info_64.h index c6d2e6c7f84..960969d5ad0 100644 --- a/include/asm-sparc/thread_info_64.h +++ b/include/asm-sparc/thread_info_64.h | |||
| @@ -155,6 +155,8 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
| 155 | #define __THREAD_INFO_ORDER 0 | 155 | #define __THREAD_INFO_ORDER 0 |
| 156 | #endif /* PAGE_SHIFT == 13 */ | 156 | #endif /* PAGE_SHIFT == 13 */ |
| 157 | 157 | ||
| 158 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 159 | |||
| 158 | #ifdef CONFIG_DEBUG_STACK_USAGE | 160 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 159 | #define alloc_thread_info(tsk) \ | 161 | #define alloc_thread_info(tsk) \ |
| 160 | ({ \ | 162 | ({ \ |
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h index 356b83e2c22..e07e72846c7 100644 --- a/include/asm-um/thread_info.h +++ b/include/asm-um/thread_info.h | |||
| @@ -53,21 +53,7 @@ static inline struct thread_info *current_thread_info(void) | |||
| 53 | return ti; | 53 | return ti; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | #ifdef CONFIG_DEBUG_STACK_USAGE | 56 | #define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER |
| 57 | |||
| 58 | #define alloc_thread_info(tsk) \ | ||
| 59 | ((struct thread_info *) __get_free_pages(GFP_KERNEL | __GFP_ZERO, \ | ||
| 60 | CONFIG_KERNEL_STACK_ORDER)) | ||
| 61 | #else | ||
| 62 | |||
| 63 | /* thread information allocation */ | ||
| 64 | #define alloc_thread_info(tsk) \ | ||
| 65 | ((struct thread_info *) __get_free_pages(GFP_KERNEL, \ | ||
| 66 | CONFIG_KERNEL_STACK_ORDER)) | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #define free_thread_info(ti) \ | ||
| 70 | free_pages((unsigned long)(ti),CONFIG_KERNEL_STACK_ORDER) | ||
| 71 | 57 | ||
| 72 | #endif | 58 | #endif |
| 73 | 59 | ||
diff --git a/include/asm-x86/thread_info.h b/include/asm-x86/thread_info.h index 3f2de105098..da0a675adf9 100644 --- a/include/asm-x86/thread_info.h +++ b/include/asm-x86/thread_info.h | |||
| @@ -152,6 +152,8 @@ struct thread_info { | |||
| 152 | #define THREAD_FLAGS GFP_KERNEL | 152 | #define THREAD_FLAGS GFP_KERNEL |
| 153 | #endif | 153 | #endif |
| 154 | 154 | ||
| 155 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 156 | |||
| 155 | #define alloc_thread_info(tsk) \ | 157 | #define alloc_thread_info(tsk) \ |
| 156 | ((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER)) | 158 | ((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER)) |
| 157 | 159 | ||
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h index a2c640682ed..7e4131dd546 100644 --- a/include/asm-xtensa/thread_info.h +++ b/include/asm-xtensa/thread_info.h | |||
| @@ -111,10 +111,6 @@ static inline struct thread_info *current_thread_info(void) | |||
| 111 | return ti; | 111 | return ti; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | /* thread information allocation */ | ||
| 115 | #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) | ||
| 116 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
| 117 | |||
| 118 | #else /* !__ASSEMBLY__ */ | 114 | #else /* !__ASSEMBLY__ */ |
| 119 | 115 | ||
| 120 | /* how to get the thread information struct from ASM */ | 116 | /* how to get the thread information struct from ASM */ |
| @@ -160,6 +156,7 @@ static inline struct thread_info *current_thread_info(void) | |||
| 160 | #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ | 156 | #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ |
| 161 | 157 | ||
| 162 | #define THREAD_SIZE 8192 //(2*PAGE_SIZE) | 158 | #define THREAD_SIZE 8192 //(2*PAGE_SIZE) |
| 159 | #define THREAD_SIZE_ORDER 1 | ||
| 163 | 160 | ||
| 164 | #endif /* __KERNEL__ */ | 161 | #endif /* __KERNEL__ */ |
| 165 | #endif /* _XTENSA_THREAD_INFO */ | 162 | #endif /* _XTENSA_THREAD_INFO */ |
diff --git a/kernel/fork.c b/kernel/fork.c index 552c8d8e77a..5a5d6fef341 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -93,6 +93,23 @@ int nr_processes(void) | |||
| 93 | static struct kmem_cache *task_struct_cachep; | 93 | static struct kmem_cache *task_struct_cachep; |
| 94 | #endif | 94 | #endif |
| 95 | 95 | ||
| 96 | #ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
| 97 | static inline struct thread_info *alloc_thread_info(struct task_struct *tsk) | ||
| 98 | { | ||
| 99 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
| 100 | gfp_t mask = GFP_KERNEL | __GFP_ZERO; | ||
| 101 | #else | ||
| 102 | gfp_t mask = GFP_KERNEL; | ||
| 103 | #endif | ||
| 104 | return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER); | ||
| 105 | } | ||
| 106 | |||
| 107 | static inline void free_thread_info(struct thread_info *ti) | ||
| 108 | { | ||
| 109 | free_pages((unsigned long)ti, THREAD_SIZE_ORDER); | ||
| 110 | } | ||
| 111 | #endif | ||
| 112 | |||
| 96 | /* SLAB cache for signal_struct structures (tsk->signal) */ | 113 | /* SLAB cache for signal_struct structures (tsk->signal) */ |
| 97 | static struct kmem_cache *signal_cachep; | 114 | static struct kmem_cache *signal_cachep; |
| 98 | 115 | ||
