encapsulates the rest of arch-dependent operations with thread_info access. Two new helpers - setup_thread_stack() and end_of_stack(). For normal case the former consists of copying thread_info of parent to new thread_info and the latter returns pointer immediately past the end of thread_info.
Showing the changes to kernel (2 of 3 files). Show all
Unified · Split
| @@ -171,10 +171,9 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) · 170 unmodified lines | ||
| 171 | 171 | return NULL; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | − *ti = *orig->thread_info; | |
| 175 | 174 | *tsk = *orig; |
| 176 | 175 | tsk->thread_info = ti; |
| 177 | − ti->task = tsk; | |
| 176 | + setup_thread_stack(tsk, orig); | |
| 178 | 177 | |
| 179 | 178 | /* One for us, one for whoever does the "release_task()" (usually parent) */ |
| 180 | 179 | atomic_set(&tsk->usage,2); |
| @@ -4327,10 +4327,10 @@ static void show_task(task_t *p) · 4326 unmodified lines | ||
| 4327 | 4327 | #endif |
| 4328 | 4328 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 4329 | 4329 | { |
| 4330 | − unsigned long *n = (unsigned long *) (p->thread_info+1); | |
| 4330 | + unsigned long *n = end_of_stack(p); | |
| 4331 | 4331 | while (!*n) |
| 4332 | 4332 | n++; |
| 4333 | − free = (unsigned long) n - (unsigned long)(p->thread_info+1); | |
| 4333 | + free = (unsigned long)n - (unsigned long)end_of_stack(p); | |
| 4334 | 4334 | } |
| 4335 | 4335 | #endif |
| 4336 | 4336 | printk("%5lu %5d %6d ", free, p->pid, p->parent->pid); |