* futex and shared memory
@ 2009-06-15 17:29 Andrew Michael Wesie
0 siblings, 0 replies; only message in thread
From: Andrew Michael Wesie @ 2009-06-15 17:29 UTC (permalink / raw)
To: linux-kernel
I have a set of LWPs with non-shared page tables (no CLONE_VM flag) and am
also using the CLONE_CHILD_CLEARTID flag. The ctid variable points to a
memory that has been mmap'd MAP_SHARED, so that it will be shared with
both the parent and the child. When the child exits, the expected behavior
is for the memory pointed to by ctid to be cleared. From what I could
tell, this wasn't happening.
After looking at mm_release in fork.c, which is responsible for clearing
the tid variable, it looks like this doesn't work since mm_release checks
if there is more than one "user" of the memory space. I am including a
patch to take out the check, but am not confident that this is the
problem. It would help if I had a clearer understanding of what mm_user
actually represented.
A patch for 2.6.30 follows.
--
Andrew Wesie
awesie@andrew.cmu.edu
--- linux-2.6.30/kernel/fork.c.orig 2009-06-15 13:25:52.000000000
-0400
+++ linux-2.6.30/kernel/fork.c 2009-06-15 13:26:25.000000000 -0400
@@ -569,8 +569,7 @@ void mm_release(struct task_struct *tsk,
* trouble otherwise. Userland only wants this done for a
sys_exit.
*/
if (tsk->clear_child_tid
- && !(tsk->flags & PF_SIGNALED)
- && atomic_read(&mm->mm_users) > 1) {
+ && !(tsk->flags & PF_SIGNALED)) {
u32 __user * tidptr = tsk->clear_child_tid;
tsk->clear_child_tid = NULL;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-15 17:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-15 17:29 futex and shared memory Andrew Michael Wesie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.