Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 29 Oct 2002 07:08:02 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 29 Oct 2002 07:08:02 -0500 Received: from elin.scali.no ([62.70.89.10]:28687 "EHLO elin.scali.no") by vger.kernel.org with ESMTP id ; Tue, 29 Oct 2002 07:07:49 -0500 Date: Tue, 29 Oct 2002 13:15:50 +0100 (CET) From: Steffen Persvold X-X-Sender: sp@sp-laptop.isdn.scali.no To: linux-kernel@vger.kernel.org cc: mingo@redhat.com Subject: kernel BUG in page_alloc.c (rmqueue function) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-1463794943-562157986-1035893750=:1944" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 11478 Lines: 223 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---1463794943-562157986-1035893750=:1944 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi all, Lately I've been struggeling with kernels Oopsing in page_alloc.c, rmqueue() function. The line which triggers the Oops is actually in expand() which is inlined from rmqueue() (and others). In my kernel source (2.4.20-pre11), expand looks like this : #define MARK_USED(index, order, area) \ __change_bit((index) >> (1+(order)), (area)->map) static inline struct page * expand (zone_t *zone, struct page *page, unsigned long index, int low, int high, free_area_t * area) { unsigned long size = 1 << high; while (high > low) { if (BAD_RANGE(zone,page)) BUG(); area--; high--; size >>= 1; list_add(&(page)->list, &(area)->free_list); MARK_USED(index, high, area); index += size; page += size; } if (BAD_RANGE(zone,page)) BUG(); return page; } The line that triggers the BUG is the last BAD_RANGE check. The module that calls __alloc_pages() is doing it in the following way : addr = __get_free_page(GFP_KERNEL); and frees the page with free_page(addr); The machine configuration is RedHat 7.3 (gcc-2.96-110, binutils-2.11.93.0.2-11), 2 Xeon processors @ 2.2 GHz and 2GB RAM. The module in question is not a part of the kernel tree, but the source is available if someone is interested. However, I'm really interrested in situations that could cause BAD_RANGE() to fail (since it is commented with a "Temporary debugging check") because of the above usage (which seems very straight forward to me). The really strange thing is that the problem seem to disappear if I apply the per_cpu_pages patch by Ingo Molnar as found in the RedHat 2.4.18-17.7.x kernel with a few modifications to make it fit on 2.4.20-pre11 (attached). Any help greatly appreciated. Thanks, -- Steffen Persvold | Scali AS mailto:sp@scali.com | http://www.scali.com Tel: (+47) 2262 8950 | Olaf Helsets vei 6 Fax: (+47) 2262 8951 | N0621 Oslo, NORWAY ---1463794943-562157986-1035893750=:1944 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="linux-2.4.20-pre11-per-cpu-pages.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="linux-2.4.20-pre11-per-cpu-pages.patch" LS0tIGxpbnV4LTIuNC4yMC1wcmUxMS9pbmNsdWRlL2xpbnV4L21tem9uZS5o Lm9sZAlNb24gT2N0IDI4IDE3OjMyOjM0IDIwMDINCisrKyBsaW51eC0yLjQu MjAtcHJlMTEvaW5jbHVkZS9saW51eC9tbXpvbmUuaAlNb24gT2N0IDI4IDA2 OjQwOjU5IDIwMDINCkBAIC0yNiw2ICsyNiwxNCBAQA0KIA0KIHN0cnVjdCBw Z2xpc3RfZGF0YTsNCiANCisjZGVmaW5lIE1BWF9QRVJfQ1BVX1BBR0VTIDUx Mg0KKw0KK3R5cGVkZWYgc3RydWN0IHBlcl9jcHVfcGFnZXNfcyB7DQorCWlu dCBucl9wYWdlczsNCisJaW50IG1heF9ucl9wYWdlczsNCisJc3RydWN0IGxp c3RfaGVhZCBoZWFkOw0KK30gX19hdHRyaWJ1dGVfXygoYWxpZ25lZChMMV9D QUNIRV9CWVRFUykpKSBwZXJfY3B1X3Q7DQorDQogLyoNCiAgKiBPbiBtYWNo aW5lcyB3aGVyZSBpdCBpcyBuZWVkZWQgKGVnIFBDcykgd2UgZGl2aWRlIHBo eXNpY2FsIG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7DQorCQkJZWxzZQ0KKwkJCQlpZiAoIXBl cl9jcHUtPm1heF9ucl9wYWdlcykNCisJCQkJCXBlcl9jcHUtPm1heF9ucl9w YWdlcyA9IDE7DQorCQl9DQogCQl6b25lLT5sb2NrID0gU1BJTl9MT0NLX1VO TE9DS0VEOw0KIAkJem9uZS0+em9uZV9wZ2RhdCA9IHBnZGF0Ow0KIAkJem9u ZS0+ZnJlZV9wYWdlcyA9IDA7DQo= ---1463794943-562157986-1035893750=:1944-- - 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/