Re: 2.4.25 SMP - BUG at page_alloc.c:105

From: Marcelo Tosatti
Date: Wed Mar 24 2004 - 15:52:07 EST



On Wed, Mar 24, 2004 at 12:28:06PM -0800, Andrew Morton wrote:
> Marcelo Tosatti <marcelo.tosatti@xxxxxxxxxxxx> wrote:
> >
> >
> > The backtrace is odd to me.
> >
> > set_page_dirty() does not call __free_pages_ok() directly or indirectly.
> >
>
> I'd suspect that's just gunk on the stack and that zap_pte_range() freed an
> anonymous page which had a non-null ->mapping. It could be a hardware bug.
> Without seeing the actual value of page->mapping it's hard to know.
>
> It would be good to backport the bad_page() debug code so we get a bit more
> info when this sort of thing happens.

This should work. Matthias, please apply and try to reproduce.

--- mm/page_alloc.c.orig 2004-03-24 18:42:53.693251224 -0300
+++ mm/page_alloc.c 2004-03-24 18:47:52.484828000 -0300
@@ -81,6 +81,20 @@
* -- wli
*/

+static void bad_page(const char *function, struct page *page)
+{
+ printk("Bad page state at %s\n", function);
+ printk("flags:0x%08lx mapping:%p buffers:%p count:%d\n",
+ page->flags, page->mapping,
+ page->buffers, page_count(page));
+ printk("Backtrace:\n");
+ dump_stack();
+ printk("bad_page: Trying to fix it up.\n");
+ set_page_count(page, 0);
+ page->mapping = NULL;
+}
+
+
static void FASTCALL(__free_pages_ok (struct page *page, unsigned int order));
static void __free_pages_ok (struct page *page, unsigned int order)
{
@@ -101,8 +115,8 @@

if (page->buffers)
BUG();
- if (page->mapping)
- BUG();
+ if (page->mapping)
+ bad_page(page);
if (!VALID_PAGE(page))
BUG();
if (PageLocked(page))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/