From linux-kernel-owner+willy=40w.ods.org@vger.kernel.org  Wed Mar 24 21:53:40 2004
Return-Path: <linux-kernel-owner+willy=40w.ods.org@vger.kernel.org>
Received: from willy.net1.nerim.net (vax [10.2.1.2])
	by alpha.home.local (8.12.4/8.12.1) with ESMTP id i2OKrdt3012907
	for <willy@w.ods.org>; Wed, 24 Mar 2004 21:53:40 +0100
Received: from vger.kernel.org (vger.kernel.org [67.72.78.212])
	by willy.net1.nerim.net (8.12.9/8.12.1) with ESMTP id i2OKra5g029325
	for <willy@w.ods.org>; Wed, 24 Mar 2004 21:53:38 +0100 (CET)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S261326AbUCXUup (ORCPT <rfc822;willy@w.ods.org>);
	Wed, 24 Mar 2004 15:50:45 -0500
Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261787AbUCXUup
	(ORCPT <rfc822;linux-kernel-outgoing>);
	Wed, 24 Mar 2004 15:50:45 -0500
Received: from hera.kernel.org ([63.209.29.2]:10130 "EHLO hera.kernel.org")
	by vger.kernel.org with ESMTP id S261326AbUCXUun (ORCPT
	<rfc822;linux-kernel@vger.kernel.org>);
	Wed, 24 Mar 2004 15:50:43 -0500
Received: from logos.cnet (marcelo@localhost [127.0.0.1])
	by hera.kernel.org (8.12.8/8.12.8) with ESMTP id i2OKoSWN032330;
	Wed, 24 Mar 2004 12:50:30 -0800
Received: by logos.cnet (Postfix, from userid 500)
	id CBEF112460A; Wed, 24 Mar 2004 18:51:13 -0300 (BRT)
Date: 	Wed, 24 Mar 2004 18:51:13 -0300
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Andrew Morton <akpm@osdl.org>
Cc: matthias.andree@gmx.de, andrea@suse.de, linux-kernel@vger.kernel.org
Subject: Re: 2.4.25 SMP - BUG at page_alloc.c:105
Message-ID: <20040324215112.GA6931@logos.cnet>
References: <20040324205811.GB6572@logos.cnet> <20040324122806.4015d3d6.akpm@osdl.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20040324122806.4015d3d6.akpm@osdl.org>
User-Agent: Mutt/1.5.5.1i
X-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	version=2.63
X-Spam-Checker-Version: 	SpamAssassin 2.63 (2004-01-11) on hera.kernel.org
Sender: linux-kernel-owner@vger.kernel.org
Precedence: bulk
X-Mailing-List: 	linux-kernel@vger.kernel.org
Status: RO
Content-Length: 1839
Lines: 58


On Wed, Mar 24, 2004 at 12:28:06PM -0800, Andrew Morton wrote:
> Marcelo Tosatti <marcelo.tosatti@cyclades.com> 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(__FUNCTION__, 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/