more thread_info patches

Roman Zippel
2005-05-30T23:48:45Z

Hi,

On Thu, 21 Apr 2005, Al Viro wrote:

> thread_info, part 1:

Here are some possible followup patches. Since it's already some time ago
here are the original posts for everyone else:
http://marc.theaimsgroup.com/?l=linux-kernel&m=111410539627881&w=2

This introduces an additional stack variable in task_struct. It's
basically redundant with the thread_info pointer, but in the long term I'd
like to get of the latter (with the following patches).

bye, Roman

---

include/linux/init_task.h | 1 +
include/linux/sched.h | 1 +
kernel/fork.c | 1 +
3 files changed, 3 insertions(+)

Index: linux-2.6-mm/include/linux/sched.h
===================================================================
--- linux-2.6-mm.orig/include/linux/sched.h 2005-05-31 01:19:01.636591190 +0200
+++ linux-2.6-mm/include/linux/sched.h 2005-05-31 01:19:05.913856451 +0200
@@ -617,6 +617,7 @@ struct mempolicy;
struct task_struct {
volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
struct thread_info *thread_info;
+ void *stack;
atomic_t usage;
unsigned long flags; /* per process flags, defined below */
unsigned long ptrace;
Index: linux-2.6-mm/include/linux/init_task.h
===================================================================
--- linux-2.6-mm.orig/include/linux/init_task.h 2005-05-31 01:19:01.636591190 +0200
+++ linux-2.6-mm/include/linux/init_task.h 2005-05-31 01:19:05.913856451 +0200
@@ -71,6 +71,7 @@ extern struct group_info init_groups;
{ \
.state = 0, \
.thread_info = &init_thread_info, \
+ .stack = &init_stack, \
.usage = ATOMIC_INIT(2), \
.flags = 0, \
.lock_depth = -1, \
Index: linux-2.6-mm/kernel/fork.c
===================================================================
--- linux-2.6-mm.orig/kernel/fork.c 2005-05-31 01:19:01.636591190 +0200
+++ linux-2.6-mm/kernel/fork.c 2005-05-31 01:19:29.954726757 +0200
@@ -173,6 +173,7 @@ static struct task_struct *dup_task_stru
*tsk = *orig;
setup_thread_info(tsk, ti);
tsk->thread_info = ti;
+ tsk->stack = ti;
ti->task = tsk;

/* One for us, one for whoever does the "release_task()" (usually parent) */