From: Hugh Dickins <hugh@veritas.com>
To: Vympel <vympel.br@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kernel bug
Date: Sun, 27 Nov 2005 12:51:08 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.61.0511271241030.24517@goblin.wat.veritas.com> (raw)
In-Reply-To: <00e101c5f228$1249d790$0301010a@home321>
On Fri, 25 Nov 2005, Vympel wrote:
> Hi, I receive this error and must reboot my server,
>
> Nov 23 15:35:09 mail kernel: kernel BUG at mm/rmap.c:487!
> Nov 23 15:35:09 mail kernel: EFLAGS: 00010286 (2.6.14-1.1637_FC4)
> Nov 23 15:35:09 mail kernel: EIP is at page_remove_rmap+0x37/0x41
I'm not very comfortable dealing with Fedora Core kernels: safer to
pursue it on their list rather than kernel.org. But the problem,
whatever it is, is probably not specific to FC, and below is the
2.6.14 version of the debug patch I usually send out for this
(I haven't tried it on FC, but believe it will suit there).
The patch has the (generally welcome) side-effect of letting the
system run on longer, despite the errors observed.
Please let me know of any "Bad rmap" and "Bad page state" messages
you get after rebuilding and rebooting your kernel with this patch,
in case they can shed light on what the problem is in your case.
Most cases either remain unresolved, or are resolved as bad memory,
overheating etc. Try memtest86 overnight to check your RAM.
Hugh
--- 2.6.14/arch/ia64/lib/swiotlb.c 2005-10-28 01:02:08.000000000 +0100
+++ linux/arch/ia64/lib/swiotlb.c 2005-11-05 19:32:12.000000000 +0000
@@ -449,6 +449,7 @@ swiotlb_map_single(struct device *hwdev,
static void
mark_clean(void *addr, size_t size)
{
+#ifndef CONFIG_X86_64 /* Yes, arch/x86_64 builds this too */
unsigned long pg_addr, end;
pg_addr = PAGE_ALIGN((unsigned long) addr);
@@ -458,6 +459,7 @@ mark_clean(void *addr, size_t size)
set_bit(PG_arch_1, &page->flags);
pg_addr += PAGE_SIZE;
}
+#endif
}
/*
--- 2.6.14/arch/x86_64/ia32/syscall32.c 2005-10-28 01:02:08.000000000 +0100
+++ linux/arch/x86_64/ia32/syscall32.c 2005-11-05 19:32:12.000000000 +0000
@@ -25,7 +25,7 @@ static struct page *
syscall32_nopage(struct vm_area_struct *vma, unsigned long adr, int *type)
{
struct page *p = virt_to_page(adr - vma->vm_start + syscall32_page);
- get_page(p);
+ SetPageReserved(p);
return p;
}
--- 2.6.14/include/linux/rmap.h 2005-08-29 00:41:01.000000000 +0100
+++ linux/include/linux/rmap.h 2005-11-05 19:32:12.000000000 +0000
@@ -72,7 +72,7 @@ void __anon_vma_link(struct vm_area_stru
*/
void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
void page_add_file_rmap(struct page *);
-void page_remove_rmap(struct page *);
+void page_remove_rmap(struct page *, struct vm_area_struct *, unsigned long);
/**
* page_dup_rmap - duplicate pte mapping to a page
--- 2.6.14/mm/fremap.c 2005-10-28 01:02:08.000000000 +0100
+++ linux/mm/fremap.c 2005-11-05 19:32:12.000000000 +0000
@@ -37,7 +37,7 @@ static inline void zap_pte(struct mm_str
if (!PageReserved(page)) {
if (pte_dirty(pte))
set_page_dirty(page);
- page_remove_rmap(page);
+ page_remove_rmap(page, vma, addr);
page_cache_release(page);
dec_mm_counter(mm, rss);
}
--- 2.6.14/mm/memory.c 2005-10-28 01:02:08.000000000 +0100
+++ linux/mm/memory.c 2005-11-05 19:32:12.000000000 +0000
@@ -526,6 +526,7 @@ int copy_page_range(struct mm_struct *ds
}
static void zap_pte_range(struct mmu_gather *tlb, pmd_t *pmd,
+ struct vm_area_struct *vma,
unsigned long addr, unsigned long end,
struct zap_details *details)
{
@@ -579,7 +580,7 @@ static void zap_pte_range(struct mmu_gat
else if (pte_young(ptent))
mark_page_accessed(page);
tlb->freed++;
- page_remove_rmap(page);
+ page_remove_rmap(page, vma, addr);
tlb_remove_page(tlb, page);
continue;
}
@@ -597,6 +598,7 @@ static void zap_pte_range(struct mmu_gat
}
static inline void zap_pmd_range(struct mmu_gather *tlb, pud_t *pud,
+ struct vm_area_struct *vma,
unsigned long addr, unsigned long end,
struct zap_details *details)
{
@@ -608,11 +610,12 @@ static inline void zap_pmd_range(struct
next = pmd_addr_end(addr, end);
if (pmd_none_or_clear_bad(pmd))
continue;
- zap_pte_range(tlb, pmd, addr, next, details);
+ zap_pte_range(tlb, pmd, vma, addr, next, details);
} while (pmd++, addr = next, addr != end);
}
static inline void zap_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
+ struct vm_area_struct *vma,
unsigned long addr, unsigned long end,
struct zap_details *details)
{
@@ -624,7 +627,7 @@ static inline void zap_pud_range(struct
next = pud_addr_end(addr, end);
if (pud_none_or_clear_bad(pud))
continue;
- zap_pmd_range(tlb, pud, addr, next, details);
+ zap_pmd_range(tlb, pud, vma, addr, next, details);
} while (pud++, addr = next, addr != end);
}
@@ -645,7 +648,7 @@ static void unmap_page_range(struct mmu_
next = pgd_addr_end(addr, end);
if (pgd_none_or_clear_bad(pgd))
continue;
- zap_pud_range(tlb, pgd, addr, next, details);
+ zap_pud_range(tlb, pgd, vma, addr, next, details);
} while (pgd++, addr = next, addr != end);
tlb_end_vma(tlb, vma);
}
@@ -1313,7 +1316,7 @@ static int do_wp_page(struct mm_struct *
if (PageReserved(old_page))
inc_mm_counter(mm, rss);
else
- page_remove_rmap(old_page);
+ page_remove_rmap(old_page, vma, address);
flush_cache_page(vma, address, pfn);
break_cow(vma, new_page, address, page_table);
lru_cache_add_active(new_page);
--- 2.6.14/mm/rmap.c 2005-10-28 01:02:08.000000000 +0100
+++ linux/mm/rmap.c 2005-11-05 19:32:12.000000000 +0000
@@ -466,8 +466,12 @@ void page_add_anon_rmap(struct page *pag
void page_add_file_rmap(struct page *page)
{
BUG_ON(PageAnon(page));
- if (!pfn_valid(page_to_pfn(page)) || PageReserved(page))
+ if (!pfn_valid(page_to_pfn(page)))
return;
+ if (PageReserved(page)) {
+ set_bit(PG_arch_1, &page->flags);
+ return;
+ }
if (atomic_inc_and_test(&page->_mapcount))
inc_page_state(nr_mapped);
@@ -479,12 +483,43 @@ void page_add_file_rmap(struct page *pag
*
* Caller needs to hold the mm->page_table_lock.
*/
-void page_remove_rmap(struct page *page)
+void page_remove_rmap(struct page *page,
+ struct vm_area_struct *vma, unsigned long address)
{
+ struct address_space *mapping = NULL;
+ unsigned long index;
+
BUG_ON(PageReserved(page));
+ index = (address - vma->vm_start) >> PAGE_SHIFT;
+ index += vma->vm_pgoff;
+
+ if (PageAnon(page))
+ mapping = (void *) vma->anon_vma + PAGE_MAPPING_ANON;
+ else if (!(vma->vm_flags & (VM_IO|VM_RESERVED)))
+ mapping = vma->vm_file? vma->vm_file->f_mapping: (void *)(-1);
+
+ if (page_mapcount(page) <= 0 || page_count(page) <= 0 ||
+ (mapping && (mapping != page->mapping || index != page->index)) ||
+ test_bit(PG_arch_1, &page->flags) /* was PageReserved before */) {
+ pgd_t *pgd = pgd_offset(vma->vm_mm, address);
+ pud_t *pud = pud_offset(pgd, address);
+ pmd_t *pmd = pmd_offset(pud, address);
+ unsigned long ptpfn = pmd_val(*pmd) >> PAGE_SHIFT;
+
+ printk(KERN_ERR "Bad rmap: "
+ "page %p flags %lx count %d mapcount %d\n",
+ page, (unsigned long)page->flags,
+ page_count(page), page_mapcount(page));
+ printk(KERN_ERR " %s addr %lx ptpfn %lx vm_flags %lx\n",
+ current->comm, address, ptpfn, vma->vm_flags);
+ printk(KERN_ERR " page mapping %p %lx vma mapping %p %lx\n",
+ page->mapping, page->index, mapping, index);
+ get_page(page); /* corrupt, so leak rather than free it */
+ return;
+ }
+
if (atomic_add_negative(-1, &page->_mapcount)) {
- BUG_ON(page_mapcount(page) < 0);
/*
* It would be tidy to reset the PageAnon mapping here,
* but that might overwrite a racing page_add_anon_rmap
@@ -560,7 +595,7 @@ static int try_to_unmap_one(struct page
}
dec_mm_counter(mm, rss);
- page_remove_rmap(page);
+ page_remove_rmap(page, vma, address);
page_cache_release(page);
out_unmap:
@@ -661,7 +696,7 @@ static void try_to_unmap_cluster(unsigne
if (pte_dirty(pteval))
set_page_dirty(page);
- page_remove_rmap(page);
+ page_remove_rmap(page, vma, address);
page_cache_release(page);
dec_mm_counter(mm, rss);
(*mapcount)--;
next prev parent reply other threads:[~2005-11-27 12:51 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-26 1:23 Vympel
2005-11-27 12:51 ` Hugh Dickins [this message]
[not found] <200907311139.55095.christoph.thielecke@gmx.de>
2009-07-31 16:01 ` kernel bug Linus Torvalds
2009-07-31 16:26 ` Eric Paris
-- strict thread matches above, loose matches on Subject: below --
2008-09-10 20:35 Todor Gyumyushev
2008-09-11 3:21 ` Aaron Straus
2008-04-13 16:06 monte
2008-04-13 18:20 ` Jesper Juhl
2008-04-13 18:33 ` Alan Cox
2008-03-29 9:05 Olver Eduardo Ramos
2008-03-30 1:06 ` Rafael J. Wysocki
2007-09-19 21:43 Kernel bug Branislav Bozgai
2007-09-24 15:33 ` Mel Gorman
2007-08-19 18:33 kernel bug Costas Sismanis
2006-12-22 11:59 Kernel BUG Rudy Zijlstra
2006-12-22 13:42 ` Peter Zijlstra
2005-11-03 18:10 Mark Fortescue
2005-11-03 18:59 ` Trond Myklebust
2005-11-03 23:15 ` Mark Fortescue
2005-11-04 10:08 ` Mark Fortescue
2003-03-26 23:57 Perez-Gonzalez, Inaky
2003-03-27 14:23 ` Hugh Dickins
2003-03-26 13:13 kasper_k_jensen
2003-01-25 22:56 Kernel bug Massimiliano C. - Uf0On|in3
2003-01-19 18:01 Christophe Dupre
2003-01-07 9:17 kernel BUG Sönke Ruempler
2002-12-07 10:09 Kernel BUG Henrik Steffen
2002-12-08 1:47 ` Alan Cox
2002-11-27 11:31 kernel bug sanket rathi
2002-11-27 10:45 sanket rathi
2002-11-27 9:50 sanket rathi
2002-11-27 10:10 ` Arjan van de Ven
2002-06-28 19:54 kernel BUG Eric Weiss
2002-06-28 19:26 ew
2002-06-27 19:23 Chaoyang Deng
2002-06-28 5:58 ` Austin Gonyou
2002-06-28 14:00 ` Mike Black
2002-05-21 14:01 kernel bug Chen Hao
2001-11-25 18:03 Kernel Bug gonzalo.ab
2001-11-25 23:59 ` Adam Schrotenboer
2001-03-06 19:55 kernel bug ernte23
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0511271241030.24517@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vympel.br@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®