]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: kill vma flag VM_RESERVED and mm->reserved_vm counter
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Mon, 8 Oct 2012 23:29:02 +0000 (16:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Oct 2012 07:22:19 +0000 (16:22 +0900)
A long time ago, in v2.4, VM_RESERVED kept swapout process off VMA,
currently it lost original meaning but still has some effects:

 | effect                 | alternative flags
-+------------------------+---------------------------------------------
1| account as reserved_vm | VM_IO
2| skip in core dump      | VM_IO, VM_DONTDUMP
3| do not merge or expand | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP
4| do not mlock           | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP

This patch removes reserved_vm counter from mm_struct.  Seems like nobody
cares about it, it does not exported into userspace directly, it only
reduces total_vm showed in proc.

Thus VM_RESERVED can be replaced with VM_IO or pair VM_DONTEXPAND | VM_DONTDUMP.

remap_pfn_range() and io_remap_pfn_range() set VM_IO|VM_DONTEXPAND|VM_DONTDUMP.
remap_vmalloc_range() set VM_DONTEXPAND | VM_DONTDUMP.

[akpm@linux-foundation.org: drivers/vfio/pci/vfio_pci.c fixup]
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Carsten Otte <cotte@de.ibm.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Eric Paris <eparis@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Venkatesh Pallipadi <venki@google.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
70 files changed:
Documentation/vm/unevictable-lru.txt
arch/alpha/kernel/pci-sysfs.c
arch/ia64/kernel/perfmon.c
arch/ia64/mm/init.c
arch/powerpc/kvm/book3s_hv.c
arch/sparc/kernel/pci.c
arch/unicore32/kernel/process.c
arch/x86/xen/mmu.c
drivers/char/mbcs.c
drivers/char/mem.c
drivers/char/mspec.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_vm.c
drivers/gpu/drm/exynos/exynos_drm_gem.c
drivers/gpu/drm/gma500/framebuffer.c
drivers/gpu/drm/ttm/ttm_bo_vm.c
drivers/gpu/drm/udl/udl_fb.c
drivers/infiniband/hw/ehca/ehca_uverbs.c
drivers/infiniband/hw/ipath/ipath_file_ops.c
drivers/infiniband/hw/qib/qib_file_ops.c
drivers/media/pci/meye/meye.c
drivers/media/platform/omap/omap_vout.c
drivers/media/platform/vino.c
drivers/media/usb/sn9c102/sn9c102_core.c
drivers/media/usb/usbvision/usbvision-video.c
drivers/media/v4l2-core/videobuf-dma-sg.c
drivers/media/v4l2-core/videobuf-vmalloc.c
drivers/media/v4l2-core/videobuf2-memops.c
drivers/misc/carma/carma-fpga.c
drivers/misc/sgi-gru/grufile.c
drivers/mtd/mtdchar.c
drivers/scsi/sg.c
drivers/staging/omapdrm/omap_gem_dmabuf.c
drivers/staging/tidspbridge/rmgr/drv_interface.c
drivers/uio/uio.c
drivers/usb/mon/mon_bin.c
drivers/video/68328fb.c
drivers/video/aty/atyfb_base.c
drivers/video/fb-puv3.c
drivers/video/fb_defio.c
drivers/video/fbmem.c
drivers/video/gbefb.c
drivers/video/omap2/omapfb/omapfb-main.c
drivers/video/sbuslib.c
drivers/video/smscufx.c
drivers/video/udlfb.c
drivers/video/vermilion/vermilion.c
drivers/video/vfb.c
drivers/xen/gntalloc.c
drivers/xen/gntdev.c
drivers/xen/privcmd.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/hugetlbfs/inode.c
fs/proc/task_mmu.c
include/linux/mempolicy.h
include/linux/mm.h
include/linux/mm_types.h
kernel/events/core.c
mm/ksm.c
mm/memory.c
mm/mlock.c
mm/mmap.c
mm/nommu.c
mm/vmalloc.c
security/selinux/selinuxfs.c
sound/core/pcm_native.c
sound/usb/usx2y/us122l.c
sound/usb/usx2y/usX2Yhwdep.c
sound/usb/usx2y/usx2yhwdeppcm.c

index fa206cccf89f8577a8a44ff84d0836b06b712cb5..323ff5dba1cce4dcecd75db001274c08827cbe62 100644 (file)
@@ -371,8 +371,8 @@ mlock_fixup() filters several classes of "special" VMAs:
    mlock_fixup() will call make_pages_present() in the hugetlbfs VMA range to
    allocate the huge pages and populate the ptes.
 
-3) VMAs with VM_DONTEXPAND or VM_RESERVED are generally userspace mappings of
-   kernel pages, such as the VDSO page, relay channel pages, etc.  These pages
+3) VMAs with VM_DONTEXPAND are generally userspace mappings of kernel pages,
+   such as the VDSO page, relay channel pages, etc. These pages
    are inherently unevictable and are not managed on the LRU lists.
    mlock_fixup() treats these VMAs the same as hugetlbfs VMAs.  It calls
    make_pages_present() to populate the ptes.
index 53649c7d0068f19e4b66b7cf8a6012ad5519f7b3..b51f7b4818cd07117308d645abfae4a91eeb0aa3 100644 (file)
@@ -26,7 +26,7 @@ static int hose_mmap_page_range(struct pci_controller *hose,
                base = sparse ? hose->sparse_io_base : hose->dense_io_base;
 
        vma->vm_pgoff += base >> PAGE_SHIFT;
-       vma->vm_flags |= (VM_IO | VM_RESERVED);
+       vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 
        return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
                                  vma->vm_end - vma->vm_start,
index f388b4e18a37f8b5868a4cbbd422f64d9a9c24b3..ea39eba61ef5abcdf087b027879196b49d75bb03 100644 (file)
@@ -2307,7 +2307,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
         */
        vma->vm_mm           = mm;
        vma->vm_file         = get_file(filp);
-       vma->vm_flags        = VM_READ| VM_MAYREAD |VM_RESERVED;
+       vma->vm_flags        = VM_READ|VM_MAYREAD|VM_DONTEXPAND|VM_DONTDUMP;
        vma->vm_page_prot    = PAGE_READONLY; /* XXX may need to change */
 
        /*
index 0eab454867a23d799cd2fc5798f616cf2131104f..082e383c1b6f22dc8370fdac789489acbb04ffba 100644 (file)
@@ -138,7 +138,8 @@ ia64_init_addr_space (void)
                        vma->vm_mm = current->mm;
                        vma->vm_end = PAGE_SIZE;
                        vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT);
-                       vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO | VM_RESERVED;
+                       vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO |
+                                       VM_DONTEXPAND | VM_DONTDUMP;
                        down_write(&current->mm->mmap_sem);
                        if (insert_vm_struct(current->mm, vma)) {
                                up_write(&current->mm->mmap_sem);
index 83e929e66f9d8cb583ccf5564c9e7f846164f5fc..721d4603a23587bf692c887a7c10c9aca73c2ccb 100644 (file)
@@ -1183,7 +1183,7 @@ static const struct vm_operations_struct kvm_rma_vm_ops = {
 
 static int kvm_rma_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = &kvm_rma_vm_ops;
        return 0;
 }
index acc8c838ff72d77dfd30cb01d96fe76316a69f53..75b31bcdeadf46c89afdd04eb778718d0f09541e 100644 (file)
@@ -779,7 +779,7 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev,
 static void __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
                                            enum pci_mmap_state mmap_state)
 {
-       vma->vm_flags |= (VM_IO | VM_RESERVED);
+       vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 }
 
 /* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
index b6f0458c3143187ced10fdde2eb4286548c869b8..b008586dad753a1b29010735b95ee71e1a704900 100644 (file)
@@ -380,7 +380,7 @@ int vectors_user_mapping(void)
        return install_special_mapping(mm, 0xffff0000, PAGE_SIZE,
                                       VM_READ | VM_EXEC |
                                       VM_MAYREAD | VM_MAYEXEC |
-                                      VM_RESERVED,
+                                      VM_DONTEXPAND | VM_DONTDUMP,
                                       NULL);
 }
 
index 5a16824cc2b3ca88919e484d79473af3f2e951a4..fd28d86fe3d2c979c5c9ac0e5ab95bf3d977a224 100644 (file)
@@ -2451,8 +2451,7 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
 
        prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP);
 
-       BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_RESERVED | VM_IO)) ==
-                               (VM_PFNMAP | VM_RESERVED | VM_IO)));
+       BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_IO)) == (VM_PFNMAP | VM_IO)));
 
        rmd.mfn = mfn;
        rmd.prot = prot;
index 0c7d340b9ab9b69aa6b977d97afe2587743f2e61..f74e892711ddfd1dc89baead7546782f30a3a5f2 100644 (file)
@@ -507,7 +507,7 @@ static int mbcs_gscr_mmap(struct file *fp, struct vm_area_struct *vma)
 
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
-       /* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */
+       /* Remap-pfn-range will mark the range VM_IO */
        if (remap_pfn_range(vma,
                            vma->vm_start,
                            __pa(soft->gscr_addr) >> PAGE_SHIFT,
index e5eedfa24c91010bd8358db7b7076e4f0af6ad1b..0537903c985b653bfd78d3005133267f43bdf538 100644 (file)
@@ -322,7 +322,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)
 
        vma->vm_ops = &mmap_mem_ops;
 
-       /* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */
+       /* Remap-pfn-range will mark the range VM_IO */
        if (remap_pfn_range(vma,
                            vma->vm_start,
                            vma->vm_pgoff,
index 845f97fd18326fbe2301a515da53483d966907a8..e1f60f968fddc8e55b932f4d2ac185835871dfb3 100644 (file)
@@ -286,7 +286,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
        atomic_set(&vdata->refcnt, 1);
        vma->vm_private_data = vdata;
 
-       vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP | VM_DONTEXPAND);
+       vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
        if (vdata->type == MSPEC_FETCHOP || vdata->type == MSPEC_UNCACHED)
                vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
        vma->vm_ops = &mspec_vm_ops;
index 92177d5aedeebd1e3b580db6113d9902bfc615a9..24efae464e2c4660a99daabbc7735e8b9d2ec2d6 100644 (file)
@@ -706,7 +706,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
                goto out_unlock;
        }
 
-       vma->vm_flags |= VM_RESERVED | VM_IO | VM_PFNMAP | VM_DONTEXPAND;
+       vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = obj->dev->driver->gem_vm_ops;
        vma->vm_private_data = map->handle;
        vma->vm_page_prot =  pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
index 23a824e6a22ab8a5a067ba857772bc0d7581f85f..db7bd292410bad8e1c2e39539e2ffa5ea730501f 100644 (file)
@@ -514,8 +514,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
 
        vma->vm_ops = &drm_vm_dma_ops;
 
-       vma->vm_flags |= VM_RESERVED;   /* Don't swap */
-       vma->vm_flags |= VM_DONTEXPAND;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
 
        drm_vm_open_locked(dev, vma);
        return 0;
@@ -643,21 +642,16 @@ int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
        case _DRM_SHM:
                vma->vm_ops = &drm_vm_shm_ops;
                vma->vm_private_data = (void *)map;
-               /* Don't let this area swap.  Change when
-                  DRM_KERNEL advisory is supported. */
-               vma->vm_flags |= VM_RESERVED;
                break;
        case _DRM_SCATTER_GATHER:
                vma->vm_ops = &drm_vm_sg_ops;
                vma->vm_private_data = (void *)map;
-               vma->vm_flags |= VM_RESERVED;
                vma->vm_page_prot = drm_dma_prot(map->type, vma);
                break;
        default:
                return -EINVAL; /* This should never happen. */
        }
-       vma->vm_flags |= VM_RESERVED;   /* Don't swap */
-       vma->vm_flags |= VM_DONTEXPAND;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
 
        drm_vm_open_locked(dev, vma);
        return 0;
index fcdbe46914f72fe6f412a959e9a6f54e54856f3d..d2545560664fe4dcf6c3cc9412e98debfab06e5b 100644 (file)
@@ -500,7 +500,7 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp,
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
-       vma->vm_flags |= (VM_IO | VM_RESERVED);
+       vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 
        update_vm_cache_attr(exynos_gem_obj, vma);
 
index 884ba73ac6ce0f42dbafd82799110cd2fdfcd15f..afded54dbb10c2b8c3b1e727625a5f637002330e 100644 (file)
@@ -178,8 +178,7 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
         */
        vma->vm_ops = &psbfb_vm_ops;
        vma->vm_private_data = (void *)psbfb;
-       vma->vm_flags |= VM_RESERVED | VM_IO |
-                                       VM_MIXEDMAP | VM_DONTEXPAND;
+       vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTDUMP;
        return 0;
 }
 
index a877813571a45f01b2383bc403163ad6e6bfabed..3ba72dbdc4bd68495030c047b4b1ae87c7b9e13a 100644 (file)
@@ -285,7 +285,7 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
         */
 
        vma->vm_private_data = bo;
-       vma->vm_flags |= VM_RESERVED | VM_IO | VM_MIXEDMAP | VM_DONTEXPAND;
+       vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTDUMP;
        return 0;
 out_unref:
        ttm_bo_unref(&bo);
@@ -300,7 +300,7 @@ int ttm_fbdev_mmap(struct vm_area_struct *vma, struct ttm_buffer_object *bo)
 
        vma->vm_ops = &ttm_bo_vm_ops;
        vma->vm_private_data = ttm_bo_reference(bo);
-       vma->vm_flags |= VM_RESERVED | VM_IO | VM_MIXEDMAP | VM_DONTEXPAND;
+       vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND;
        return 0;
 }
 EXPORT_SYMBOL(ttm_fbdev_mmap);
index 67df842fbb339333b4869bfa568463d136c7bb85..69a2b16f42a60284d2d8eecb8ae1fe01fe8e2ced 100644 (file)
@@ -243,7 +243,7 @@ static int udl_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
                        size = 0;
        }
 
-       vma->vm_flags |= VM_RESERVED;   /* avoid to swap out this VMA */
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
        return 0;
 }
 
index 45ee89b65c23fbf57350e8a5cb04840180bd2035..1a1d5d99fcf9175bedddb9af689ff245e230131b 100644 (file)
@@ -117,7 +117,7 @@ static int ehca_mmap_fw(struct vm_area_struct *vma, struct h_galpas *galpas,
        physical = galpas->user.fw_handle;
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
        ehca_gen_dbg("vsize=%llx physical=%llx", vsize, physical);
-       /* VM_IO | VM_RESERVED are set by remap_pfn_range() */
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
        ret = remap_4k_pfn(vma, vma->vm_start, physical >> EHCA_PAGESHIFT,
                           vma->vm_page_prot);
        if (unlikely(ret)) {
@@ -139,7 +139,7 @@ static int ehca_mmap_queue(struct vm_area_struct *vma, struct ipz_queue *queue,
        u64 start, ofs;
        struct page *page;
 
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        start = vma->vm_start;
        for (ofs = 0; ofs < queue->queue_length; ofs += PAGE_SIZE) {
                u64 virt_addr = (u64)ipz_qeit_calc(queue, ofs);
index 736d9edbdbe720bb25a2e1ace073984e43373faa..3eb7e454849b4e1e7064dcb5cbdd84a03c18f307 100644 (file)
@@ -1225,7 +1225,7 @@ static int mmap_kvaddr(struct vm_area_struct *vma, u64 pgaddr,
 
        vma->vm_pgoff = (unsigned long) addr >> PAGE_SHIFT;
        vma->vm_ops = &ipath_file_vm_ops;
-       vma->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        ret = 1;
 
 bail:
index faa44cb08071c7cf3f5413448f09aefb8de1b1c1..959a5c4ff812de7034d27d6a0935c567ade3ebf1 100644 (file)
@@ -971,7 +971,7 @@ static int mmap_kvaddr(struct vm_area_struct *vma, u64 pgaddr,
 
        vma->vm_pgoff = (unsigned long) addr >> PAGE_SHIFT;
        vma->vm_ops = &qib_file_vm_ops;
-       vma->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        ret = 1;
 
 bail:
index 7bc775219f9722fb6e6dd2e27905cf6113cf7dfd..e5a76da860816897ff7740b905f16015d71aadc0 100644 (file)
@@ -1647,7 +1647,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
 
        vma->vm_ops = &meye_vm_ops;
        vma->vm_flags &= ~VM_IO;        /* not I/O memory */
-       vma->vm_flags |= VM_RESERVED;   /* avoid to swap out this VMA */
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_private_data = (void *) (offset / gbufsize);
        meye_vm_open(vma);
 
index 66ac21d466afa29a6975fb0cabf61b1e69b8b356..134016f0e660dce4e76ad9cd8e13b184ea49d563 100644 (file)
@@ -911,7 +911,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
 
        q->bufs[i]->baddr = vma->vm_start;
 
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
        vma->vm_ops = &omap_vout_vm_ops;
        vma->vm_private_data = (void *) vout;
index 790d96cffeea7d7ca0bbb808a23173e3b77373df..70b0bf4b2900ecd5e5619e85cf66dcc7c36de636 100644 (file)
@@ -3950,7 +3950,7 @@ found:
 
        fb->map_count = 1;
 
-       vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_flags &= ~VM_IO;
        vma->vm_private_data = fb;
        vma->vm_file = file;
index 19ea780b16ffbc9b9539eb0c0891cb2d6af27ce0..5bfc8e2f018f20fb07389b7fadf8902c7073714e 100644 (file)
@@ -2126,8 +2126,7 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma)
                return -EINVAL;
        }
 
-       vma->vm_flags |= VM_IO;
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 
        pos = cam->frame[i].bufmem;
        while (size > 0) { /* size is page-aligned */
index f67018ed3795a349b95ceb8efbc22689f62c204d..5c36a57e6590d6c731341663296faad17607a7ef 100644 (file)
@@ -1108,8 +1108,7 @@ static int usbvision_mmap(struct file *file, struct vm_area_struct *vma)
        }
 
        /* VM_IO is eventually going to replace PageReserved altogether */
-       vma->vm_flags |= VM_IO;
-       vma->vm_flags |= VM_RESERVED;   /* avoid to swap out this VMA */
+       vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 
        pos = usbvision->frame[i].data;
        while (size > 0) {
index f300deafd268e555e54f1d9cdefbc22c97cd75cc..828e7c10bd701cc9b598f26721a413de7d378cde 100644 (file)
@@ -582,7 +582,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
        map->count    = 1;
        map->q        = q;
        vma->vm_ops   = &videobuf_vm_ops;
-       vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_flags &= ~VM_IO; /* using shared anonymous pages */
        vma->vm_private_data = map;
        dprintk(1, "mmap %p: q=%p %08lx-%08lx pgoff %08lx bufs %d-%d\n",
index df142580e44cfac0b9451411a43bcd461f572de0..2ff7fcc77b1104fe7d1ca1a2a9d5738ede27acb7 100644 (file)
@@ -270,7 +270,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
        }
 
        vma->vm_ops          = &videobuf_vm_ops;
-       vma->vm_flags       |= VM_DONTEXPAND | VM_RESERVED;
+       vma->vm_flags       |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_private_data = map;
 
        dprintk(1, "mmap %p: q=%p %08lx-%08lx (%lx) pgoff %08lx buf %d\n",
index 504cd4cbe29e44f40f822240eb21b03364136f65..051ea3571b208968d6b55ed3f8568038898f1b84 100644 (file)
@@ -163,7 +163,7 @@ int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
                return ret;
        }
 
-       vma->vm_flags           |= VM_DONTEXPAND | VM_RESERVED;
+       vma->vm_flags           |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_private_data    = priv;
        vma->vm_ops             = vm_ops;
 
index 0c43297ed9ac6262ca2e901703f3e3bb3c10a2cb..8835eabb3b8730d45d4deffb533bb6bf5ff332c4 100644 (file)
@@ -1243,8 +1243,6 @@ static int data_mmap(struct file *filp, struct vm_area_struct *vma)
                return -EINVAL;
        }
 
-       /* IO memory (stop cacheing) */
-       vma->vm_flags |= VM_IO | VM_RESERVED;
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
        return io_remap_pfn_range(vma, vma->vm_start, addr, vsize,
index ecafa4ba238b3ca4991a20dc5e6bb88458aee8de..492c8cac69acfbd78d6ee33170b58617d8891bc3 100644 (file)
@@ -108,9 +108,8 @@ static int gru_file_mmap(struct file *file, struct vm_area_struct *vma)
                                vma->vm_end & (GRU_GSEG_PAGESIZE - 1))
                return -EINVAL;
 
-       vma->vm_flags |=
-           (VM_IO | VM_DONTCOPY | VM_LOCKED | VM_DONTEXPAND | VM_PFNMAP |
-                       VM_RESERVED);
+       vma->vm_flags |= VM_IO | VM_PFNMAP | VM_LOCKED |
+                        VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_page_prot = PAGE_SHARED;
        vma->vm_ops = &gru_vm_ops;
 
index a6e74514e6624e95f8e6e56fb319d567b1011f78..73ae81a629f274b0a81af26e0f32cd328a95a55a 100644 (file)
@@ -1182,7 +1182,7 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
                        return -EINVAL;
                if (set_vm_offset(vma, off) < 0)
                        return -EINVAL;
-               vma->vm_flags |= VM_IO | VM_RESERVED;
+               vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 
 #ifdef pgprot_noncached
                if (file->f_flags & O_DSYNC || off >= __pa(high_memory))
index 9c5c5f2b3962626c39d645bfaa8da63c16808df4..be2c9a6561ffa4a95f0f1bb2b8718f74a6923ea2 100644 (file)
@@ -1257,7 +1257,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
        }
 
        sfp->mmap_called = 1;
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_private_data = sfp;
        vma->vm_ops = &sg_mmap_vm_ops;
        return 0;
index 42728e0cc1945816574dd5879b8bcdc907c2bb92..c6f3ef6f57b9671e1dd18cc158faa831442895b4 100644 (file)
@@ -160,7 +160,7 @@ static int omap_gem_dmabuf_mmap(struct dma_buf *buffer,
                goto out_unlock;
        }
 
-       vma->vm_flags |= VM_RESERVED | VM_IO | VM_PFNMAP | VM_DONTEXPAND;
+       vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = obj->dev->driver->gem_vm_ops;
        vma->vm_private_data = obj;
        vma->vm_page_prot =  pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
index bddea1d3b2c3ab5081063caff948046b2b769690..701a11ac676d31d90d36320bae2ad9137deb68dd 100644 (file)
@@ -261,7 +261,7 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 {
        u32 status;
 
-       vma->vm_flags |= VM_RESERVED | VM_IO;
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
        dev_dbg(bridge, "%s: vm filp %p start %lx end %lx page_prot %ulx "
index a783d533a1a6fe662e99cd26ebec87c6569bd9bf..5110f367f1f15884bb313468ff5f06453aafd7b4 100644 (file)
@@ -653,8 +653,6 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
        if (mi < 0)
                return -EINVAL;
 
-       vma->vm_flags |= VM_IO | VM_RESERVED;
-
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
        return remap_pfn_range(vma,
@@ -666,7 +664,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
 
 static int uio_mmap_logical(struct vm_area_struct *vma)
 {
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = &uio_vm_ops;
        uio_vma_open(vma);
        return 0;
index 91cd85076a44b1b22a3cd93f4fcb96d743228bc5..9a62e89d6dc0b720cf7cdd59b1530be024187c28 100644 (file)
@@ -1247,7 +1247,7 @@ static int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma)
 {
        /* don't do anything here: "fault" will set up page table entries */
        vma->vm_ops = &mon_bin_vm_ops;
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_private_data = filp->private_data;
        mon_bin_vma_open(vma);
        return 0;
index a425d65d5ba2d5d2e66f513f5dfcfa29b62de186..fa44fbed397d0ee5eac4694efba7432fefb025e7 100644 (file)
@@ -400,7 +400,7 @@ static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 #ifndef MMU
        /* this is uClinux (no MMU) specific code */
 
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_start = videomemory;
 
        return 0;
index 3f2e8c13f1ca745bd0d0fbe9ce51784823c276e4..868932f904ef21b85e12b4de1b260bed1c662065 100644 (file)
@@ -1942,8 +1942,7 @@ static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
        off = vma->vm_pgoff << PAGE_SHIFT;
        size = vma->vm_end - vma->vm_start;
 
-       /* To stop the swapper from even considering these pages. */
-       vma->vm_flags |= (VM_IO | VM_RESERVED);
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
 
        if (((vma->vm_pgoff == 0) && (size == info->fix.smem_len)) ||
            ((off == info->fix.smem_len) && (size == PAGE_SIZE)))
index 60a787fa32cfe97ddc8cdbb2999492e4da99144d..7d106f1f49069f78a43feb0dd2bdaee3befa43ca 100644 (file)
@@ -653,9 +653,8 @@ int unifb_mmap(struct fb_info *info,
                                vma->vm_page_prot))
                return -EAGAIN;
 
-       vma->vm_flags |= VM_RESERVED;   /* avoid to swap out this VMA */
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
        return 0;
-
 }
 
 static struct fb_ops unifb_ops = {
index 64cda560c488358c9205d66e064657bd6ba7203e..88cad6b8b479d44d4b402044a3d23460f64c8c2c 100644 (file)
@@ -166,7 +166,7 @@ static const struct address_space_operations fb_deferred_io_aops = {
 static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
        vma->vm_ops = &fb_deferred_io_vm_ops;
-       vma->vm_flags |= ( VM_RESERVED | VM_DONTEXPAND );
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        if (!(info->flags & FBINFO_VIRTFB))
                vma->vm_flags |= VM_IO;
        vma->vm_private_data = info;
index 0dff12a1daef26af52949a6ff52f3b5c9de61a61..3ff0105a496a592cc9c1136c585efc463aa9de49 100644 (file)
@@ -1410,8 +1410,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
                return -EINVAL;
        off += start;
        vma->vm_pgoff = off >> PAGE_SHIFT;
-       /* This is an IO map - tell maydump to skip this VMA */
-       vma->vm_flags |= VM_IO | VM_RESERVED;
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by io_remap_pfn_range()*/
        vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
        fb_pgprotect(file, vma, off);
        if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
index 7e7b7a9ba274ba2d33450b68b76a55ba21fab898..05e2a8a99d8fbc63545da7625298e6a895ba5c6c 100644 (file)
@@ -1024,7 +1024,7 @@ static int gbefb_mmap(struct fb_info *info,
        pgprot_val(vma->vm_page_prot) =
                pgprot_fb(pgprot_val(vma->vm_page_prot));
 
-       vma->vm_flags |= VM_IO | VM_RESERVED;
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
 
        /* look for the starting tile */
        tile = &gbe_tiles.cpu[offset >> TILE_SHIFT];
index 3c39aa8de9285d65676f284343530b5516d019f7..15373f4aee1976435b5f6d94d48b1f824ab718a2 100644 (file)
@@ -1128,7 +1128,7 @@ static int omapfb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
        DBG("user mmap region start %lx, len %d, off %lx\n", start, len, off);
 
        vma->vm_pgoff = off >> PAGE_SHIFT;
-       vma->vm_flags |= VM_IO | VM_RESERVED;
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
        vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
        vma->vm_ops = &mmap_user_ops;
        vma->vm_private_data = rg;
index 3c1de981a18cf77a49fbe2b9239112e29ecfe547..296afae442f4853cf1a0ddb81d4bd2df15eaaa2a 100644 (file)
@@ -57,9 +57,8 @@ int sbusfb_mmap_helper(struct sbus_mmap_map *map,
 
        off = vma->vm_pgoff << PAGE_SHIFT;
 
-       /* To stop the swapper from even considering these pages */
-       vma->vm_flags |= (VM_IO | VM_RESERVED);
-       
+       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
+
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
        /* Each page, see which map applies */
index 5533a32c6ca132e8c981b7306c88d354fea7a23c..97bd6620c36494d993b0d77877a2531be80250c3 100644 (file)
@@ -803,7 +803,6 @@ static int ufx_ops_mmap(struct fb_info *info, struct vm_area_struct *vma)
                        size = 0;
        }
 
-       vma->vm_flags |= VM_RESERVED;   /* avoid to swap out this VMA */
        return 0;
 }
 
index 8af64148294b88074a269f54691d05a9cb00a547..f45eba3d6150f73b6e12a3e78bba58dd389a3a90 100644 (file)
@@ -345,7 +345,6 @@ static int dlfb_ops_mmap(struct fb_info *info, struct vm_area_struct *vma)
                        size = 0;
        }
 
-       vma->vm_flags |= VM_RESERVED;   /* avoid to swap out this VMA */
        return 0;
 }
 
index 970e43d13f52bdce1a4a5cfc4e782745ddf53657..89aef343e2951b71f3a34d4377aa7aaa27b63fcb 100644 (file)
@@ -1018,7 +1018,6 @@ static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
        offset += vinfo->vram_start;
        pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
        pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
-       vma->vm_flags |= VM_RESERVED | VM_IO;
        if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT,
                                                size, vma->vm_page_prot))
                return -EAGAIN;
index 501a922aa9dc425c0d45258c8fb19ac897d51da9..c7f692525b8849a64a492577bde6861c55bae71d 100644 (file)
@@ -439,7 +439,6 @@ static int vfb_mmap(struct fb_info *info,
                        size = 0;
        }
 
-       vma->vm_flags |= VM_RESERVED;   /* avoid to swap out this VMA */
        return 0;
 
 }
index 934985d14c2459f6893a8b1c4712b98207830d8a..4097987b330e6235d3ddf5df79119f15c7bf9b10 100644 (file)
@@ -535,7 +535,7 @@ static int gntalloc_mmap(struct file *filp, struct vm_area_struct *vma)
 
        vma->vm_private_data = vm_priv;
 
-       vma->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
 
        vma->vm_ops = &gntalloc_vmops;
 
index 5df9fd847b2eebbc87fe668e136d1c0684a7905c..610bfc6be17708594783d231d608c14651625376 100644 (file)
@@ -720,7 +720,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
 
        vma->vm_ops = &gntdev_vmops;
 
-       vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
 
        if (use_ptemod)
                vma->vm_flags |= VM_DONTCOPY;
index ef6389580b8c78dd30a8c7738098c51b6ef3133a..8adb9cc267f96e201ade041441ef8a317ce336d8 100644 (file)
@@ -455,7 +455,8 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
 {
        /* DONTCOPY is essential for Xen because copy_page_range doesn't know
         * how to recreate these mappings */
-       vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP;
+       vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTCOPY |
+                        VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = &privcmd_vm_ops;
        vma->vm_private_data = NULL;
 
index 2b72d26e2e4b5da6809d5dc9fad2783aa2d99475..e800dec958c3273ea91aea2a865daa49d9874224 100644 (file)
@@ -1135,7 +1135,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
        }
 
        /* Do not dump I/O mapped devices or special mappings */
-       if (vma->vm_flags & (VM_IO | VM_RESERVED))
+       if (vma->vm_flags & VM_IO)
                return 0;
 
        /* By default, dump shared memory if mapped from an anonymous file. */
index 08d812b3228262650473fc4ef0599a47cc898f65..262db114ff0162dd24761c842af617a017e992ea 100644 (file)
@@ -1205,7 +1205,7 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
        int dump_ok;
 
        /* Do not dump I/O mapped devices or special mappings */
-       if (vma->vm_flags & (VM_IO | VM_RESERVED)) {
+       if (vma->vm_flags & VM_IO) {
                kdcore("%08lx: %08lx: no (IO)", vma->vm_start, vma->vm_flags);
                return 0;
        }
index 9460120a5170213cc7bf1e3e6d79db4674b63571..0a0ab8e21b19ebbf4a204b4bfd68025fb95f16cc 100644 (file)
@@ -110,7 +110,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
         * way when do_mmap_pgoff unwinds (may be important on powerpc
         * and ia64).
         */
-       vma->vm_flags |= VM_HUGETLB | VM_RESERVED;
+       vma->vm_flags |= VM_HUGETLB | VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = &hugetlb_vm_ops;
 
        if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT))
index 4540b8f76f163fbaaef250b6facf161424a90869..79827ce03e3bc00208aced44caa7ae9fd2d08bd3 100644 (file)
@@ -54,7 +54,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm)
                "VmPTE:\t%8lu kB\n"
                "VmSwap:\t%8lu kB\n",
                hiwater_vm << (PAGE_SHIFT-10),
-               (total_vm - mm->reserved_vm) << (PAGE_SHIFT-10),
+               total_vm << (PAGE_SHIFT-10),
                mm->locked_vm << (PAGE_SHIFT-10),
                mm->pinned_vm << (PAGE_SHIFT-10),
                hiwater_rss << (PAGE_SHIFT-10),
index 95b738c7abff9ac1e45a5e78e1daf1437b2283fd..ba7a0ff19d39997f84f483343bfecc5a15886db2 100644 (file)
@@ -239,7 +239,7 @@ extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
 /* Check if a vma is migratable */
 static inline int vma_migratable(struct vm_area_struct *vma)
 {
-       if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED))
+       if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP))
                return 0;
        /*
         * Migration allocates pages in the highest zone. If we cannot
index dc08d558e058d8a5e2ea94564edd2da42add2b76..0514fe9d3c842f797a2ef52883cd74ec50bf7abf 100644 (file)
@@ -96,7 +96,6 @@ extern unsigned int kobjsize(const void *objp);
 
 #define VM_DONTCOPY    0x00020000      /* Do not copy this vma on fork */
 #define VM_DONTEXPAND  0x00040000      /* Cannot expand with mremap() */
-#define VM_RESERVED    0x00080000      /* Count as reserved_vm like IO */
 #define VM_ACCOUNT     0x00100000      /* Is a VM accounted object */
 #define VM_NORESERVE   0x00200000      /* should the VM suppress accounting */
 #define VM_HUGETLB     0x00400000      /* Huge TLB Page VM */
@@ -148,7 +147,7 @@ extern unsigned int kobjsize(const void *objp);
  * Special vmas that are non-mergable, non-mlock()able.
  * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
  */
-#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP)
+#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP)
 
 /*
  * mapping from the currently active vm_flags protection bits (the
index 58d3173eb365d42ec7e7ce1cc0e00d52b01e7d5e..a57a43f5ca7c4982e29c8fe7012cee9828505b7a 100644 (file)
@@ -349,7 +349,6 @@ struct mm_struct {
        unsigned long shared_vm;        /* Shared pages (files) */
        unsigned long exec_vm;          /* VM_EXEC & ~VM_WRITE */
        unsigned long stack_vm;         /* VM_GROWSUP/DOWN */
-       unsigned long reserved_vm;      /* VM_RESERVED|VM_IO pages */
        unsigned long def_flags;
        unsigned long nr_ptes;          /* Page table pages */
        unsigned long start_code, end_code, start_data, end_data;
index f16f3c58f11ad008d145edc1517a57eccfb03d65..cda3ebd49e86f1d219ae9cbd2eaa357e2b48888b 100644 (file)
@@ -3671,7 +3671,7 @@ unlock:
                atomic_inc(&event->mmap_count);
        mutex_unlock(&event->mmap_mutex);
 
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = &perf_mmap_vmops;
 
        return ret;
index f9ccb16559ee6620566cbb6cc2e64297546c65a6..9638620a7530ed2b35ab381e751ab0ab90018cdb 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1469,8 +1469,7 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
                 */
                if (*vm_flags & (VM_MERGEABLE | VM_SHARED  | VM_MAYSHARE   |
                                 VM_PFNMAP    | VM_IO      | VM_DONTEXPAND |
-                                VM_RESERVED  | VM_HUGETLB |
-                                VM_NONLINEAR | VM_MIXEDMAP))
+                                VM_HUGETLB | VM_NONLINEAR | VM_MIXEDMAP))
                        return 0;               /* just ignore the advice */
 
 #ifdef VM_SAO
index 7b1e4feaec0683de581031496f55f1fe252b46bb..e09c048131869ac3c956aa8d6cfbec9677cdc642 100644 (file)
@@ -2297,14 +2297,13 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
         * rest of the world about it:
         *   VM_IO tells people not to look at these pages
         *      (accesses can have side effects).
-        *   VM_RESERVED is specified all over the place, because
-        *      in 2.4 it kept swapout's vma scan off this vma; but
-        *      in 2.6 the LRU scan won't even find its pages, so this
-        *      flag means no more than count its pages in reserved_vm,
-        *      and omit it from core dump, even when VM_IO turned off.
         *   VM_PFNMAP tells the core MM that the base pages are just
         *      raw PFN mappings, and do not have a "struct page" associated
         *      with them.
+        *   VM_DONTEXPAND
+        *      Disable vma merging and expanding with mremap().
+        *   VM_DONTDUMP
+        *      Omit vma from core dump, even when VM_IO turned off.
         *
         * There's a horrible special case to handle copy-on-write
         * behaviour that some programs depend on. We mark the "original"
@@ -2321,7 +2320,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
        if (err)
                return -EINVAL;
 
-       vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
+       vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
 
        BUG_ON(addr >= end);
        pfn -= addr >> PAGE_SHIFT;
index ef726e8aa8e9ca56c0713abfa4b621f44a210d4c..a948be4b7ba7673aa77cf7b537d8a650cd558a15 100644 (file)
@@ -227,7 +227,7 @@ long mlock_vma_pages_range(struct vm_area_struct *vma,
        if (vma->vm_flags & (VM_IO | VM_PFNMAP))
                goto no_mlock;
 
-       if (!((vma->vm_flags & (VM_DONTEXPAND | VM_RESERVED)) ||
+       if (!((vma->vm_flags & VM_DONTEXPAND) ||
                        is_vm_hugetlb_page(vma) ||
                        vma == get_gate_vma(current->mm))) {
 
index c1ad2e78ea5877616ec92e06194be2264f0ae838..a76042dc806d0ae18b1e416c9df567873bd5b24f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -945,8 +945,6 @@ void vm_stat_account(struct mm_struct *mm, unsigned long flags,
                        mm->exec_vm += pages;
        } else if (flags & stack_flags)
                mm->stack_vm += pages;
-       if (flags & (VM_RESERVED|VM_IO))
-               mm->reserved_vm += pages;
 }
 #endif /* CONFIG_PROC_FS */
 
index 9c4a7b63a4dfe582dff7825bcdcb0d3c81da5f7e..12e84e69dd0642619878dc246b28e047e8ea8476 100644 (file)
@@ -1811,7 +1811,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
        if (addr != (pfn << PAGE_SHIFT))
                return -EINVAL;
 
-       vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
+       vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
        return 0;
 }
 EXPORT_SYMBOL(remap_pfn_range);
index 2bb90b1d241cc872da1e13dd80b449b2d323e812..8de704679bfc595be27703c081c8b2fc57e36e10 100644 (file)
@@ -2163,8 +2163,7 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
                usize -= PAGE_SIZE;
        } while (usize > 0);
 
-       /* Prevent "things" like memory migration? VM_flags need a cleanup... */
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
 
        return 0;
 }
index 55af8c5b57e645d821073e197c8dd5e8cb4c3b9a..3a6e8731646c45f5a79dade0362c75e696d54eae 100644 (file)
@@ -485,7 +485,7 @@ static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
                        return -EACCES;
        }
 
-       vma->vm_flags |= VM_RESERVED;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = &sel_mmap_policy_ops;
 
        return 0;
index 20554eff5a21947fe3806902d6825534868e702e..5e12e5bacbba36cdf64c41a1d6e7e3d984902cf9 100644 (file)
@@ -3039,7 +3039,7 @@ static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file
                return -EINVAL;
        area->vm_ops = &snd_pcm_vm_ops_status;
        area->vm_private_data = substream;
-       area->vm_flags |= VM_RESERVED;
+       area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        return 0;
 }
 
@@ -3076,7 +3076,7 @@ static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file
                return -EINVAL;
        area->vm_ops = &snd_pcm_vm_ops_control;
        area->vm_private_data = substream;
-       area->vm_flags |= VM_RESERVED;
+       area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        return 0;
 }
 #else /* ! coherent mmap */
@@ -3170,7 +3170,7 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = {
 int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
                             struct vm_area_struct *area)
 {
-       area->vm_flags |= VM_RESERVED;
+       area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
 #ifdef ARCH_HAS_DMA_MMAP_COHERENT
        if (!substream->ops->page &&
            substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV)
index c4fd3b1d95927f8eab2b2bfc21d745f3578f94f6..d0323a693ba20f4719731369f85324e9ba582096 100644 (file)
@@ -262,7 +262,7 @@ static int usb_stream_hwdep_mmap(struct snd_hwdep *hw,
        }
 
        area->vm_ops = &usb_stream_hwdep_vm_ops;
-       area->vm_flags |= VM_RESERVED;
+       area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        area->vm_private_data = us122l;
        atomic_inc(&us122l->mmap_count);
 out:
index 04aafb43a13c9fbdc5eca982cdc6d13718d5245d..0b34dbc8f3020436d3e740bb61dea9f648a745ab 100644 (file)
@@ -82,7 +82,7 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v
                us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
        }
        area->vm_ops = &us428ctls_vm_ops;
-       area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
+       area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        area->vm_private_data = hw->private_data;
        return 0;
 }
index 8e40b6e67e9eeeb7ea8a9dd53dd4c73fced97b5c..cc56007791e02192bd6176050a252b1eed2fc53a 100644 (file)
@@ -723,7 +723,7 @@ static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, st
                return -ENODEV;
        }
        area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops;
-       area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
+       area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
        area->vm_private_data = hw->private_data;
        return 0;
 }