-/*
- * Task structure and kernel stack allocation.
- */
-static unsigned long *thread_info_head;
-static unsigned int nr_thread_info;
-
-#define EXTRA_TASK_STRUCT 4
-#define ll_alloc_task_struct() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
-#define ll_free_task_struct(p) free_pages((unsigned long)(p),1)
-
-struct thread_info *alloc_thread_info(struct task_struct *task)
-{
- struct thread_info *thread = NULL;
-
- if (EXTRA_TASK_STRUCT) {
- unsigned long *p = thread_info_head;
-
- if (p) {
- thread_info_head = (unsigned long *)p[0];
- nr_thread_info -= 1;
- }
- thread = (struct thread_info *)p;
- }
-
- if (!thread)
- thread = ll_alloc_task_struct();
-
-#ifdef CONFIG_MAGIC_SYSRQ
- /*
- * The stack must be cleared if you want SYSRQ-T to
- * give sensible stack usage information
- */
- if (thread) {
- char *p = (char *)thread;
- memzero(p+KERNEL_STACK_SIZE, KERNEL_STACK_SIZE);
- }
-#endif
- return thread;
-}
-
-void free_thread_info(struct thread_info *thread)
-{
- if (EXTRA_TASK_STRUCT && nr_thread_info < EXTRA_TASK_STRUCT) {
- unsigned long *p = (unsigned long *)thread;
- p[0] = (unsigned long)thread_info_head;
- thread_info_head = p;
- nr_thread_info += 1;
- } else
- ll_free_task_struct(thread);
-}
-