aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh.dickins@tiscali.co.uk>2009-09-21 20:02:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:33 -0400
commit8314c4f24a0a5c9b1f7544e9fa83a1d5367ddaa7 (patch)
treef3265e2ff817e447c11b9f9070ce1eed9a19731a
parent7701c9c0f54feb682d0cefa2ae1f4a1e00e0ba09 (diff)
ksm: remove VM_MERGEABLE_FLAGS
KSM originally stood for Kernel Shared Memory: but the kernel has long supported shared memory, and VM_SHARED and VM_MAYSHARE vmas, and KSM is something else. So we switched to saying "merge" instead of "share". But Chris Wright points out that this is confusing where mmap.c merges adjacent vmas: most especially in the name VM_MERGEABLE_FLAGS, used by is_mergeable_vma() to let vmas be merged despite flags being different. Call it VMA_MERGE_DESPITE_FLAGS? Perhaps, but at present it consists only of VM_CAN_NONLINEAR: so for now it's clearer on all sides to use that directly, with a comment on it in is_mergeable_vma(). Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Acked-by: Izik Eidus <ieidus@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/mmap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index ffd6c6c9bcf4..22dff49d579e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -657,9 +657,6 @@ again: remove_next = 1 + (end > next->vm_end);
657 validate_mm(mm); 657 validate_mm(mm);
658} 658}
659 659
660/* Flags that can be inherited from an existing mapping when merging */
661#define VM_MERGEABLE_FLAGS (VM_CAN_NONLINEAR)
662
663/* 660/*
664 * If the vma has a ->close operation then the driver probably needs to release 661 * If the vma has a ->close operation then the driver probably needs to release
665 * per-vma resources, so we don't attempt to merge those. 662 * per-vma resources, so we don't attempt to merge those.
@@ -667,7 +664,8 @@ again: remove_next = 1 + (end > next->vm_end);
667static inline int is_mergeable_vma(struct vm_area_struct *vma, 664static inline int is_mergeable_vma(struct vm_area_struct *vma,
668 struct file *file, unsigned long vm_flags) 665 struct file *file, unsigned long vm_flags)
669{ 666{
670 if ((vma->vm_flags ^ vm_flags) & ~VM_MERGEABLE_FLAGS) 667 /* VM_CAN_NONLINEAR may get set later by f_op->mmap() */
668 if ((vma->vm_flags ^ vm_flags) & ~VM_CAN_NONLINEAR)
671 return 0; 669 return 0;
672 if (vma->vm_file != file) 670 if (vma->vm_file != file)
673 return 0; 671 return 0;