aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/process.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-15 20:19:52 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-15 20:19:52 -0400
commit18594822fcb01d4b35e05b9018f770a0b4156d1a (patch)
tree38d35c38086a564beaac215f8e52694cdbfab1c3 /arch/arm/kernel/process.c
parent5b5ffbc1e6d62d89747f3f59c09b2e488a7d7fce (diff)
parentc4694c76ce28dd7e415b4f3014d8c6e580b5f3d2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'arch/arm/kernel/process.c')
-rw-r--r--arch/arm/kernel/process.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 1ff75cee4b0d..1a1539e3a946 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -264,8 +264,12 @@ void show_fpregs(struct user_fp *regs)
264/* 264/*
265 * Task structure and kernel stack allocation. 265 * Task structure and kernel stack allocation.
266 */ 266 */
267static unsigned long *thread_info_head; 267struct thread_info_list {
268static unsigned int nr_thread_info; 268 unsigned long *head;
269 unsigned int nr;
270};
271
272static DEFINE_PER_CPU(struct thread_info_list, thread_info_list) = { NULL, 0 };
269 273
270#define EXTRA_TASK_STRUCT 4 274#define EXTRA_TASK_STRUCT 4
271 275
@@ -274,12 +278,15 @@ struct thread_info *alloc_thread_info(struct task_struct *task)
274 struct thread_info *thread = NULL; 278 struct thread_info *thread = NULL;
275 279
276 if (EXTRA_TASK_STRUCT) { 280 if (EXTRA_TASK_STRUCT) {
277 unsigned long *p = thread_info_head; 281 struct thread_info_list *th = &get_cpu_var(thread_info_list);
282 unsigned long *p = th->head;
278 283
279 if (p) { 284 if (p) {
280 thread_info_head = (unsigned long *)p[0]; 285 th->head = (unsigned long *)p[0];
281 nr_thread_info -= 1; 286 th->nr -= 1;
282 } 287 }
288 put_cpu_var(thread_info_list);
289
283 thread = (struct thread_info *)p; 290 thread = (struct thread_info *)p;
284 } 291 }
285 292
@@ -300,13 +307,19 @@ struct thread_info *alloc_thread_info(struct task_struct *task)
300 307
301void free_thread_info(struct thread_info *thread) 308void free_thread_info(struct thread_info *thread)
302{ 309{
303 if (EXTRA_TASK_STRUCT && nr_thread_info < EXTRA_TASK_STRUCT) { 310 if (EXTRA_TASK_STRUCT) {
304 unsigned long *p = (unsigned long *)thread; 311 struct thread_info_list *th = &get_cpu_var(thread_info_list);
305 p[0] = (unsigned long)thread_info_head; 312 if (th->nr < EXTRA_TASK_STRUCT) {
306 thread_info_head = p; 313 unsigned long *p = (unsigned long *)thread;
307 nr_thread_info += 1; 314 p[0] = th->head;
308 } else 315 th->head = p;
309 free_pages((unsigned long)thread, THREAD_SIZE_ORDER); 316 th->nr += 1;
317 put_cpu_var(thread_info_list);
318 return;
319 }
320 put_cpu_var(thread_info_list);
321 }
322 free_pages((unsigned long)thread, THREAD_SIZE_ORDER);
310} 323}
311 324
312/* 325/*