[lkml]   [2009]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    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

    --- linux-2.6.30/kernel/fork.c.orig 2009-06-15 13:25:52.000000000
    +++ 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
    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    [W:0.022 / U:14.068 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site