[PATCH] mm: remove VM_LOCKED before remap_pfn_range and drop VM_SHM
authorChristoph Lameter <clameter@sgi.com>
Sun, 25 Jun 2006 12:46:47 +0000 (05:46 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 25 Jun 2006 17:00:55 +0000 (10:00 -0700)
Remove VM_LOCKED before remap_pfn range from device drivers and get rid of
VM_SHM.

remap_pfn_range() already sets VM_IO.  There is no need to set VM_SHM since
it does nothing.  VM_LOCKED is of no use since the remap_pfn_range does not
place pages on the LRU.  The pages are therefore never subject to swap
anyways.  Remove all the vm_flags settings before calling remap_pfn_range.

After removing all the vm_flag settings no use of VM_SHM is left.  Drop it.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
14 files changed:
arch/arm/kernel/bios32.c
arch/cris/arch-v32/drivers/pci/bios.c
arch/i386/pci/i386.c
arch/ia64/pci/pci.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/pci_64.c
arch/powerpc/kernel/proc_ppc64.c
arch/ppc/kernel/pci.c
arch/xtensa/kernel/pci.c
drivers/char/mmtimer.c
drivers/sbus/char/flash.c
drivers/sbus/char/vfc_dev.c
drivers/video/igafb.c
include/linux/mm.h

index de606dfa8db934dc53d24440a8f862372baf0ba4..302fc140154797e8d2d59045a40a940cad69092a 100644 (file)
@@ -702,7 +702,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        /*
         * Mark this as IO
         */
-       vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
        if (remap_pfn_range(vma, vma->vm_start, phys,
index 24bc149889b6d00976ea3c0115546c0c5d2a1db0..1e9d062103aec24a993c8c0e4263e4e9778df9a3 100644 (file)
@@ -27,8 +27,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        /* Leave vm_pgoff as-is, the PCI space address is the physical
         * address on this platform.
         */
-       vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO);
-
        prot = pgprot_val(vma->vm_page_prot);
        vma->vm_page_prot = __pgprot(prot);
 
index 7852827a599b07b5f6a5f053c617a7ac70259eaa..a151f7a99f5e8010a7f9875cede3f9aceb81ed61 100644 (file)
@@ -285,8 +285,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        /* Leave vm_pgoff as-is, the PCI space address is the physical
         * address on this platform.
         */
-       vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO);
-
        prot = pgprot_val(vma->vm_page_prot);
        if (boot_cpu_data.x86 > 3)
                prot |= _PAGE_PCD | _PAGE_PWT;
index 61dd8608da4f9483288f2eed009c1ebe15d93a7d..77375a55da312fd7b4ac5ddcb68933aadc381e83 100644 (file)
@@ -602,8 +602,6 @@ pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
         * Leave vm_pgoff as-is, the PCI space address is the physical
         * address on this platform.
         */
-       vma->vm_flags |= (VM_SHM | VM_RESERVED | VM_IO);
-
        if (write_combine && efi_range_is_wc(vma->vm_start,
                                             vma->vm_end - vma->vm_start))
                vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
@@ -666,7 +664,6 @@ pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma)
 
        vma->vm_pgoff += (unsigned long)addr >> PAGE_SHIFT;
        vma->vm_page_prot = prot;
-       vma->vm_flags |= (VM_SHM | VM_RESERVED | VM_IO);
 
        if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
                            size, vma->vm_page_prot))
index c858eb4bef17aad3fe2ba1dcf9eb6188d0a0f1f8..b5431ccf1147ae551c763b0fd360d3857c4ee00b 100644 (file)
@@ -1654,7 +1654,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                return -EINVAL;
 
        vma->vm_pgoff = offset >> PAGE_SHIFT;
-       vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
        vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp,
                                                  vma->vm_page_prot,
                                                  mmap_state, write_combine);
index 5ad87c426bed6de4557e9f2abea3855fbd1f3c50..247937dd8b736aab99a79df9bd6d5711bf951a4a 100644 (file)
@@ -877,7 +877,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                return -EINVAL;
 
        vma->vm_pgoff = offset >> PAGE_SHIFT;
-       vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
        vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp,
                                                  vma->vm_page_prot,
                                                  mmap_state, write_combine);
index 2b87f82df13516cd623e5e42f7f7e673431513c0..2ab8f2be911e055c2d38b726816f9d7fc6b0f3ef 100644 (file)
@@ -115,8 +115,6 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
 {
        struct proc_dir_entry *dp = PDE(file->f_dentry->d_inode);
 
-       vma->vm_flags |= VM_SHM | VM_LOCKED;
-
        if ((vma->vm_end - vma->vm_start) > dp->size)
                return -EINVAL;
 
index 809673a36f7a2fb77d7759e098cab7e3d0c67085..d20accf9650dcbacc4ec88806c074d150cd10dca 100644 (file)
@@ -1032,7 +1032,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                return -EINVAL;
 
        vma->vm_pgoff = offset >> PAGE_SHIFT;
-       vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
        vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp,
                                                  vma->vm_page_prot,
                                                  mmap_state, write_combine);
index de19501aa809afc4784bcfc9affba6e6b3c313a2..c6f471b9eaa0c603f356441bea6b980c2e85492e 100644 (file)
@@ -349,17 +349,6 @@ __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
        return -EINVAL;
 }
 
-/*
- * Set vm_flags of VMA, as appropriate for this architecture, for a pci device
- * mapping.
- */
-static __inline__ void
-__pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
-                    enum pci_mmap_state mmap_state)
-{
-       vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
-}
-
 /*
  * Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
  * device mapping.
@@ -399,7 +388,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        if (ret < 0)
                return ret;
 
-       __pci_mmap_set_flags(dev, vma, mmap_state);
        __pci_mmap_set_pgprot(dev, vma, mmap_state, write_combine);
 
        ret = io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
index 1b05fa688996dc8e94e5e26c0436d5e5ea92ca52..d65b3109318a347f402f51db1d9bcf6c9107bf4f 100644 (file)
@@ -329,7 +329,6 @@ static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma)
        if (PAGE_SIZE > (1 << 16))
                return -ENOSYS;
 
-       vma->vm_flags |= (VM_IO | VM_SHM | VM_LOCKED );
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
        mmtimer_addr = __pa(RTC_COUNTER_ADDR);
index 5ae684c011f898ab295d692eff361b9278d8a7bd..31b8a5f6116f83fc88a30e4459e4fe6dbc2590b0 100644 (file)
@@ -71,7 +71,6 @@ flash_mmap(struct file *file, struct vm_area_struct *vma)
        if (vma->vm_end - (vma->vm_start + (vma->vm_pgoff << PAGE_SHIFT)) > size)
                size = vma->vm_end - (vma->vm_start + (vma->vm_pgoff << PAGE_SHIFT));
 
-       vma->vm_flags |= (VM_SHM | VM_LOCKED);
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
        if (io_remap_pfn_range(vma, vma->vm_start, addr, size, vma->vm_page_prot))
index dfdd6be551f3ecca3a878b159514ccf96c0c5dce..ddcd330b9e891a46291650b12d917f90923c5277 100644 (file)
@@ -623,7 +623,7 @@ static int vfc_mmap(struct file *file, struct vm_area_struct *vma)
                map_size = sizeof(struct vfc_regs);
 
        vma->vm_flags |=
-               (VM_SHM | VM_LOCKED | VM_IO | VM_MAYREAD | VM_MAYWRITE | VM_MAYSHARE);
+               (VM_MAYREAD | VM_MAYWRITE | VM_MAYSHARE);
        map_offset = (unsigned int) (long)dev->phys_regs;
        ret = io_remap_pfn_range(vma, vma->vm_start,
                                  MK_IOSPACE_PFN(dev->which_io,
index 6b88050d21bfbb4ae37bd96dbab85fcda267c5b8..8a0c2d3d3805623ea891d4cc4dea6fa589e1c35d 100644 (file)
@@ -232,9 +232,6 @@ static int igafb_mmap(struct fb_info *info,
 
        size = vma->vm_end - vma->vm_start;
 
-       /* To stop the swapper from even considering these pages. */
-       vma->vm_flags |= (VM_SHM | VM_LOCKED);
-
        /* Each page, see which map applies */
        for (page = 0; page < size; ) {
                map_size = 0;
index 3b09444121d926376c3d24ca06a76e83802697f1..71c5d2f667ed90ea40a47f14b1291e332da91bbd 100644 (file)
@@ -145,7 +145,6 @@ extern unsigned int kobjsize(const void *objp);
 
 #define VM_GROWSDOWN   0x00000100      /* general info on the segment */
 #define VM_GROWSUP     0x00000200
-#define VM_SHM         0x00000000      /* Means nothing: delete it later */
 #define VM_PFNMAP      0x00000400      /* Page-ranges managed without "struct page", just pure PFN */
 #define VM_DENYWRITE   0x00000800      /* ETXTBSY on write attempts.. */