lkml.org 
[lkml]   [2003]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patches in this message
    /
    Date
    From
    SubjectRe: [PATCH] Alternate futex non-page-pinning and COW fix
    Jamie Lokier <jamie@shareable.org> wrote:
    >
    > You will be please to know I have written a complete patch :)

    Looks pretty sane to me. A couple of (untested) fixups:



    Take mmap_sem for writing around the modification of vma->vm_flags.

    But hold it for reading across the populate function: it does I/O and is
    slow.



    25-akpm/mm/fremap.c | 14 ++++++++------
    1 files changed, 8 insertions(+), 6 deletions(-)

    diff -puN mm/fremap.c~futex-non-page-pinning-akpm-1 mm/fremap.c
    --- 25/mm/fremap.c~futex-non-page-pinning-akpm-1 Wed Sep 3 08:16:30 2003
    +++ 25-akpm/mm/fremap.c Wed Sep 3 08:19:21 2003
    @@ -144,7 +144,10 @@ long sys_remap_file_pages(unsigned long
    return err;
    #endif

    - down_read(&mm->mmap_sem);
    + /*
    + * vm_flags is protected by down_write(mmap_sem)
    + */
    + down_write(&mm->mmap_sem);

    vma = find_vma(mm, start);
    /*
    @@ -161,13 +164,12 @@ long sys_remap_file_pages(unsigned long
    if (start == vma->vm_start && end == vma->vm_end &&
    pgoff == vma->vm_pgoff)
    vma->vm_flags &= ~VM_NONLINEAR;
    -
    + downgrade_write(&mm->mmap_sem);
    err = vma->vm_ops->populate(vma, start, size, vma->vm_page_prot,
    pgoff, flags & MAP_NONBLOCK);
    + up_read(&mm->mmap_sem);
    + } else {
    + up_write(&mm->mmap_sem);
    }
    -
    - up_read(&mm->mmap_sem);
    -
    return err;
    }
    -
    _


    schedule_timeout() returns in state TASK_RUNNING.


    25-akpm/kernel/futex.c | 1 -
    1 files changed, 1 deletion(-)
    diff -puN kernel/futex.c~futex-non-page-pinning-akpm-2 kernel/futex.c
    --- 25/kernel/futex.c~futex-non-page-pinning-akpm-2 Wed Sep 3 08:31:34 2003
    +++ 25-akpm/kernel/futex.c Wed Sep 3 08:31:47 2003
    @@ -358,7 +358,6 @@ static inline int futex_wait(unsigned lo

    spin_unlock(&futex_lock);
    time = schedule_timeout(time);
    - set_current_state(TASK_RUNNING);

    /*
    * NOTE: we don't remove ourselves from the waitqueue because
    _

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:48    [W:0.027 / U:31.992 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site