diff options
author | Nick Piggin <npiggin@suse.de> | 2006-03-22 03:08:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-22 10:54:02 -0500 |
commit | b7ab795b7bec9997d4fde39f249d52823d36d98d (patch) | |
tree | 8b8825a0718ec38b5b0840fe06efa9a92a0e30c7 | |
parent | 6626c5d53bc45c59798628677ba5606f02e371f3 (diff) |
[PATCH] mm: more CONFIG_DEBUG_VM
Put a few more checks under CONFIG_DEBUG_VM
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/memory.c | 12 | ||||
-rw-r--r-- | mm/rmap.c | 9 |
2 files changed, 7 insertions, 14 deletions
diff --git a/mm/memory.c b/mm/memory.c index 6af555c1c42a..71bc664efed5 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -388,7 +388,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_ | |||
388 | { | 388 | { |
389 | unsigned long pfn = pte_pfn(pte); | 389 | unsigned long pfn = pte_pfn(pte); |
390 | 390 | ||
391 | if (vma->vm_flags & VM_PFNMAP) { | 391 | if (unlikely(vma->vm_flags & VM_PFNMAP)) { |
392 | unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT; | 392 | unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT; |
393 | if (pfn == vma->vm_pgoff + off) | 393 | if (pfn == vma->vm_pgoff + off) |
394 | return NULL; | 394 | return NULL; |
@@ -396,18 +396,12 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_ | |||
396 | return NULL; | 396 | return NULL; |
397 | } | 397 | } |
398 | 398 | ||
399 | /* | 399 | #ifdef CONFIG_DEBUG_VM |
400 | * Add some anal sanity checks for now. Eventually, | ||
401 | * we should just do "return pfn_to_page(pfn)", but | ||
402 | * in the meantime we check that we get a valid pfn, | ||
403 | * and that the resulting page looks ok. | ||
404 | * | ||
405 | * Remove this test eventually! | ||
406 | */ | ||
407 | if (unlikely(!pfn_valid(pfn))) { | 400 | if (unlikely(!pfn_valid(pfn))) { |
408 | print_bad_pte(vma, pte, addr); | 401 | print_bad_pte(vma, pte, addr); |
409 | return NULL; | 402 | return NULL; |
410 | } | 403 | } |
404 | #endif | ||
411 | 405 | ||
412 | /* | 406 | /* |
413 | * NOTE! We still have PageReserved() pages in the page | 407 | * NOTE! We still have PageReserved() pages in the page |
@@ -56,13 +56,11 @@ | |||
56 | 56 | ||
57 | #include <asm/tlbflush.h> | 57 | #include <asm/tlbflush.h> |
58 | 58 | ||
59 | //#define RMAP_DEBUG /* can be enabled only for debugging */ | ||
60 | |||
61 | struct kmem_cache *anon_vma_cachep; | 59 | struct kmem_cache *anon_vma_cachep; |
62 | 60 | ||
63 | static inline void validate_anon_vma(struct vm_area_struct *find_vma) | 61 | static inline void validate_anon_vma(struct vm_area_struct *find_vma) |
64 | { | 62 | { |
65 | #ifdef RMAP_DEBUG | 63 | #ifdef CONFIG_DEBUG_VM |
66 | struct anon_vma *anon_vma = find_vma->anon_vma; | 64 | struct anon_vma *anon_vma = find_vma->anon_vma; |
67 | struct vm_area_struct *vma; | 65 | struct vm_area_struct *vma; |
68 | unsigned int mapcount = 0; | 66 | unsigned int mapcount = 0; |
@@ -551,13 +549,14 @@ void page_add_file_rmap(struct page *page) | |||
551 | void page_remove_rmap(struct page *page) | 549 | void page_remove_rmap(struct page *page) |
552 | { | 550 | { |
553 | if (atomic_add_negative(-1, &page->_mapcount)) { | 551 | if (atomic_add_negative(-1, &page->_mapcount)) { |
554 | if (page_mapcount(page) < 0) { | 552 | #ifdef CONFIG_DEBUG_VM |
553 | if (unlikely(page_mapcount(page) < 0)) { | ||
555 | printk (KERN_EMERG "Eeek! page_mapcount(page) went negative! (%d)\n", page_mapcount(page)); | 554 | printk (KERN_EMERG "Eeek! page_mapcount(page) went negative! (%d)\n", page_mapcount(page)); |
556 | printk (KERN_EMERG " page->flags = %lx\n", page->flags); | 555 | printk (KERN_EMERG " page->flags = %lx\n", page->flags); |
557 | printk (KERN_EMERG " page->count = %x\n", page_count(page)); | 556 | printk (KERN_EMERG " page->count = %x\n", page_count(page)); |
558 | printk (KERN_EMERG " page->mapping = %p\n", page->mapping); | 557 | printk (KERN_EMERG " page->mapping = %p\n", page->mapping); |
559 | } | 558 | } |
560 | 559 | #endif | |
561 | BUG_ON(page_mapcount(page) < 0); | 560 | BUG_ON(page_mapcount(page) < 0); |
562 | /* | 561 | /* |
563 | * It would be tidy to reset the PageAnon mapping here, | 562 | * It would be tidy to reset the PageAnon mapping here, |