lkml.org 
[lkml]   [2009]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectfutex and shared memory
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;


\
 
 \ /
  Last update: 2009-06-15 19:41    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site