aboutsummaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2007-06-27 17:09:53 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-28 14:34:53 -0400
commit30acbabae38793c9c9acace4de5b1c1889570768 (patch)
treec9c1741f04382803475c113865deed065e1ca0cf /mm/rmap.c
parent172d0496cd22c98ee2e4238821fa309c01685f3a (diff)
mm: kill validate_anon_vma to avoid mapcount BUG
validate_anon_vma gave a useful check on the integrity of the anon_vma list when Andrea was developing obj rmap; but it was not enabled in SLES9 itself, nor in mainline, until Nick changed commented-out RMAP_DEBUG to configurable CONFIG_DEBUG_VM in 2.6.17. Now Petr Vandrovec reports that its BUG_ON(mapcount > 100000) can easily crash a CONFIG_DEBUG_VM=y system. That limit was just an arbitrary number to protect against an infinite loop. We could raise it to something enormous (depending on sizeof struct vma and size of memory?); but I rather think validate_anon_vma has outlived its usefulness, and is better just removed - which gives a magnificent performance boost to anything like Petr's test program ;) Of course, a very long anon_vma list is bad news for preemption latency, and I believe there has been one recent report of such: let's not forget that, but validate_anon_vma only makes it worse not better. Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: Petr Vandrovec <petr@vmware.com> Acked-by: Nick Piggin <npiggin@suse.de> Cc: Andrea Arcangeli <andrea@suse.de> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/rmap.c')
-rw-r--r--mm/rmap.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index 850165d32b7a..61e492597a0b 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -53,24 +53,6 @@
53 53
54struct kmem_cache *anon_vma_cachep; 54struct kmem_cache *anon_vma_cachep;
55 55
56static inline void validate_anon_vma(struct vm_area_struct *find_vma)
57{
58#ifdef CONFIG_DEBUG_VM
59 struct anon_vma *anon_vma = find_vma->anon_vma;
60 struct vm_area_struct *vma;
61 unsigned int mapcount = 0;
62 int found = 0;
63
64 list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
65 mapcount++;
66 BUG_ON(mapcount > 100000);
67 if (vma == find_vma)
68 found = 1;
69 }
70 BUG_ON(!found);
71#endif
72}
73
74/* This must be called under the mmap_sem. */ 56/* This must be called under the mmap_sem. */
75int anon_vma_prepare(struct vm_area_struct *vma) 57int anon_vma_prepare(struct vm_area_struct *vma)
76{ 58{
@@ -121,10 +103,8 @@ void __anon_vma_link(struct vm_area_struct *vma)
121{ 103{
122 struct anon_vma *anon_vma = vma->anon_vma; 104 struct anon_vma *anon_vma = vma->anon_vma;
123 105
124 if (anon_vma) { 106 if (anon_vma)
125 list_add_tail(&vma->anon_vma_node, &anon_vma->head); 107 list_add_tail(&vma->anon_vma_node, &anon_vma->head);
126 validate_anon_vma(vma);
127 }
128} 108}
129 109
130void anon_vma_link(struct vm_area_struct *vma) 110void anon_vma_link(struct vm_area_struct *vma)
@@ -134,7 +114,6 @@ void anon_vma_link(struct vm_area_struct *vma)
134 if (anon_vma) { 114 if (anon_vma) {
135 spin_lock(&anon_vma->lock); 115 spin_lock(&anon_vma->lock);
136 list_add_tail(&vma->anon_vma_node, &anon_vma->head); 116 list_add_tail(&vma->anon_vma_node, &anon_vma->head);
137 validate_anon_vma(vma);
138 spin_unlock(&anon_vma->lock); 117 spin_unlock(&anon_vma->lock);
139 } 118 }
140} 119}
@@ -148,7 +127,6 @@ void anon_vma_unlink(struct vm_area_struct *vma)
148 return; 127 return;
149 128
150 spin_lock(&anon_vma->lock); 129 spin_lock(&anon_vma->lock);
151 validate_anon_vma(vma);
152 list_del(&vma->anon_vma_node); 130 list_del(&vma->anon_vma_node);
153 131
154 /* We must garbage collect the anon_vma if it's empty */ 132 /* We must garbage collect the anon_vma if it's empty */