Commit 496084cb authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] thread management - take three

you have applied my independent-pointer patch already, but i think your
CLEARTID variant is the most elegant solution: it reuses a clone argument,
thus reduces the number of arguments and it's also a nice conceptual pair
to the existing SETTID call. And the TID field can be used as a 'usage'
field as well, because the TID (PID) can never be 0, reducing the number
of fields in the TCB. And we can change the userspace locking code to use
the TID field no problem.
parent eb2e58fd
......@@ -566,7 +566,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
struct_cpy(childregs, regs);
childregs->eax = 0;
childregs->esp = esp;
p->user_vm_lock = NULL;
p->user_tid = NULL;
p->thread.esp = (unsigned long) childregs;
p->thread.esp0 = (unsigned long) (childregs+1);
......@@ -591,7 +591,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
/*
* The common fastpath:
*/
if (!(clone_flags & (CLONE_SETTLS | CLONE_SETTID | CLONE_RELEASE_VM)))
if (!(clone_flags & (CLONE_SETTLS | CLONE_SETTID | CLONE_CLEARTID)))
return 0;
/*
* Set a new TLS for the child thread?
......@@ -623,10 +623,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
return -EFAULT;
/*
* Does the userspace VM want any unlock on mm_release()?
* Does the userspace VM want the TID cleared on mm_release()?
*/
if (clone_flags & CLONE_RELEASE_VM)
p->user_vm_lock = (long *) childregs->edi;
if (clone_flags & CLONE_CLEARTID)
p->user_tid = (long *) childregs->edx;
return 0;
}
......
......@@ -47,8 +47,8 @@ struct exec_domain;
#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
#define CLONE_SETTID 0x00100000 /* write the TID back to userspace */
#define CLONE_DETACHED 0x00200000 /* parent wants no child-exit signal */
#define CLONE_RELEASE_VM 0x00400000 /* release the userspace VM */
#define CLONE_CLEARTID 0x00200000 /* clear the userspace TID */
#define CLONE_DETACHED 0x00400000 /* parent wants no child-exit signal */
#define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
......@@ -307,7 +307,7 @@ struct task_struct {
wait_queue_head_t wait_chldexit; /* for wait4() */
struct completion *vfork_done; /* for vfork() */
long *user_vm_lock; /* for CLONE_RELEASE_VM */
long *user_tid; /* for CLONE_CLEARTID */
unsigned long rt_priority;
unsigned long it_real_value, it_prof_value, it_virt_value;
......
......@@ -370,12 +370,12 @@ void mm_release(void)
tsk->vfork_done = NULL;
complete(vfork_done);
}
if (tsk->user_vm_lock)
if (tsk->user_tid)
/*
* We dont check the error code - if userspace has
* not set up a proper pointer then tough luck.
*/
put_user(0UL, tsk->user_vm_lock);
put_user(0UL, tsk->user_tid);
}
static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment