lkml.org 
[lkml]   [2007]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[patch 2/3] only allow nonlinear vmas for ram backed filesystems
    From
    Date
    From: Miklos Szeredi <mszeredi@suse.cz>

    Dirty page accounting/limiting doesn't work for nonlinear mappings, so
    for non-ram backed filesystems emulate with linear mappings. This
    retains ABI compatibility with previous kernels at minimal code cost.

    All known users of nonlinear mappings actually use tmpfs, so this
    shouldn't have any negative effect.

    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
    ---

    Index: linux-2.6.21-rc4-mm1/mm/fremap.c
    ===================================================================
    --- linux-2.6.21-rc4-mm1.orig/mm/fremap.c 2007-03-24 22:30:05.000000000 +0100
    +++ linux-2.6.21-rc4-mm1/mm/fremap.c 2007-03-24 22:37:59.000000000 +0100
    @@ -181,6 +181,24 @@ asmlinkage long sys_remap_file_pages(uns
    goto retry;
    }
    mapping = vma->vm_file->f_mapping;
    + /*
    + * page_mkclean doesn't work on nonlinear vmas, so if dirty
    + * pages need to be accounted, emulate with linear vmas.
    + */
    + if (mapping_cap_account_dirty(mapping)) {
    + unsigned long addr;
    +
    + flags &= MAP_NONBLOCK;
    + addr = mmap_region(vma->vm_file, start, size, flags,
    + vma->vm_flags, pgoff, 1);
    + if (IS_ERR_VALUE(addr))
    + err = addr;
    + else {
    + BUG_ON(addr != start);
    + err = 0;
    + }
    + goto out;
    + }
    spin_lock(&mapping->i_mmap_lock);
    flush_dcache_mmap_lock(mapping);
    vma->vm_flags |= VM_NONLINEAR;
    -
    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: 2007-03-24 23:11    [W:0.029 / U:59.052 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site