diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2012-05-05 11:05:41 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2012-05-08 07:55:20 -0400 |
commit | 41101809a865dd0be1b56eff46c83fad321870b2 (patch) | |
tree | be62c4da213f9ab79ac3f874f1ed8c6af0ff5b0a /kernel/fork.c | |
parent | 2889f60814e15dea644782597d897cdba943564f (diff) |
fork: Provide weak arch_release_[task_struct|thread_info] functions
These functions allow us to move most of the duplicated thread_info
allocators to the core code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120505150141.366461660@linutronix.de
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 5d22b9b8cf7b..2dfad0269674 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -112,14 +112,26 @@ int nr_processes(void) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR | 114 | #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR |
115 | # define alloc_task_struct_node(node) \ | ||
116 | kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node) | ||
117 | # define free_task_struct(tsk) \ | ||
118 | kmem_cache_free(task_struct_cachep, (tsk)) | ||
119 | static struct kmem_cache *task_struct_cachep; | 115 | static struct kmem_cache *task_struct_cachep; |
116 | |||
117 | static inline struct task_struct *alloc_task_struct_node(int node) | ||
118 | { | ||
119 | return kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node); | ||
120 | } | ||
121 | |||
122 | void __weak arch_release_task_struct(struct task_struct *tsk) { } | ||
123 | |||
124 | static inline void free_task_struct(struct task_struct *tsk) | ||
125 | { | ||
126 | arch_release_task_struct(tsk); | ||
127 | kmem_cache_free(task_struct_cachep, tsk); | ||
128 | } | ||
120 | #endif | 129 | #endif |
121 | 130 | ||
122 | #ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR | 131 | #ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR |
132 | |||
133 | void __weak arch_release_thread_info(struct thread_info *ti) { } | ||
134 | |||
123 | static struct thread_info *alloc_thread_info_node(struct task_struct *tsk, | 135 | static struct thread_info *alloc_thread_info_node(struct task_struct *tsk, |
124 | int node) | 136 | int node) |
125 | { | 137 | { |
@@ -131,6 +143,7 @@ static struct thread_info *alloc_thread_info_node(struct task_struct *tsk, | |||
131 | 143 | ||
132 | static inline void free_thread_info(struct thread_info *ti) | 144 | static inline void free_thread_info(struct thread_info *ti) |
133 | { | 145 | { |
146 | arch_release_thread_info(ti); | ||
134 | free_pages((unsigned long)ti, THREAD_SIZE_ORDER); | 147 | free_pages((unsigned long)ti, THREAD_SIZE_ORDER); |
135 | } | 148 | } |
136 | #endif | 149 | #endif |