Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43387
b: refs/heads/master
c: 1222144
h: refs/heads/master
i:
  43385: eb6d679
  43383: f116e41
v: v3
  • Loading branch information
Paul Gortmaker authored and Russell King committed Nov 30, 2006
1 parent 831064d commit bfa4c02
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 64 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b531ce242159bd26e09b55d8fb4be3f4bf75e24
refs/heads/master: 122214428a7bfab2c09b417f3acdb06222e81748
61 changes: 0 additions & 61 deletions trunk/arch/arm/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,67 +280,6 @@ void show_fpregs(struct user_fp *regs)
(unsigned long)regs->fpcr);
}

/*
* Task structure and kernel stack allocation.
*/
struct thread_info_list {
unsigned long *head;
unsigned int nr;
};

static DEFINE_PER_CPU(struct thread_info_list, thread_info_list) = { NULL, 0 };

#define EXTRA_TASK_STRUCT 4

struct thread_info *alloc_thread_info(struct task_struct *task)
{
struct thread_info *thread = NULL;

if (EXTRA_TASK_STRUCT) {
struct thread_info_list *th = &get_cpu_var(thread_info_list);
unsigned long *p = th->head;

if (p) {
th->head = (unsigned long *)p[0];
th->nr -= 1;
}
put_cpu_var(thread_info_list);

thread = (struct thread_info *)p;
}

if (!thread)
thread = (struct thread_info *)
__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);

#ifdef CONFIG_DEBUG_STACK_USAGE
/*
* The stack must be cleared if you want SYSRQ-T to
* give sensible stack usage information
*/
if (thread)
memzero(thread, THREAD_SIZE);
#endif
return thread;
}

void free_thread_info(struct thread_info *thread)
{
if (EXTRA_TASK_STRUCT) {
struct thread_info_list *th = &get_cpu_var(thread_info_list);
if (th->nr < EXTRA_TASK_STRUCT) {
unsigned long *p = (unsigned long *)thread;
p[0] = (unsigned long)th->head;
th->head = p;
th->nr += 1;
put_cpu_var(thread_info_list);
return;
}
put_cpu_var(thread_info_list);
}
free_pages((unsigned long)thread, THREAD_SIZE_ORDER);
}

/*
* Free current thread data structures etc..
*/
Expand Down
14 changes: 12 additions & 2 deletions trunk/include/asm-arm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,18 @@ static inline struct thread_info *current_thread_info(void)
return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
}

extern struct thread_info *alloc_thread_info(struct task_struct *task);
extern void free_thread_info(struct thread_info *);
/* thread information allocation */
#ifdef CONFIG_DEBUG_STACK_USAGE
#define alloc_thread_info(tsk) \
((struct thread_info *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, \
THREAD_SIZE_ORDER))
#else
#define alloc_thread_info(tsk) \
((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
#endif

#define free_thread_info(info) \
free_pages((unsigned long)info, THREAD_SIZE_ORDER);

#define thread_saved_pc(tsk) \
((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
Expand Down

0 comments on commit bfa4c02

Please sign in to comment.