Occasionally I worry about all those BUG_ON tests we keep adding into
page_alloc.c. This patch does one preliminary test of all the flags
before trying individually. Maybe you consider this in bad taste,
or maybe you think it's worthwhile: as you wish.
--- 2.5.42-mm3/mm/page_alloc.c Tue Oct 15 06:43:41 2002
+++ linux/mm/page_alloc.c Tue Oct 15 13:14:35 2002
@@ -125,12 +125,19 @@
static void free_pages_check(struct page *page)
{
- BUG_ON(PageLRU(page));
- BUG_ON(PagePrivate(page));
- BUG_ON(page->mapping != NULL);
- BUG_ON(PageLocked(page));
- BUG_ON(PageActive(page));
- BUG_ON(PageWriteback(page));
+ BUG_ON(page->mapping);
+ if (unlikely(page->flags & (
+ 1 << PG_lru |
+ 1 << PG_private |
+ 1 << PG_locked |
+ 1 << PG_active |
+ 1 << PG_writeback ))) {
+ BUG_ON(PageLRU(page));
+ BUG_ON(PagePrivate(page));
+ BUG_ON(PageLocked(page));
+ BUG_ON(PageActive(page));
+ BUG_ON(PageWriteback(page));
+ }
BUG_ON(page->pte.direct != 0);
if (PageDirty(page))
ClearPageDirty(page);
@@ -204,12 +211,20 @@
static struct page *prep_new_page(struct page *page)
{
BUG_ON(page->mapping);
- BUG_ON(PagePrivate(page));
- BUG_ON(PageLocked(page));
- BUG_ON(PageLRU(page));
- BUG_ON(PageActive(page));
- BUG_ON(PageDirty(page));
- BUG_ON(PageWriteback(page));
+ if (unlikely(page->flags & (
+ 1 << PG_private |
+ 1 << PG_locked |
+ 1 << PG_lru |
+ 1 << PG_active |
+ 1 << PG_dirty |
+ 1 << PG_writeback ))) {
+ BUG_ON(PagePrivate(page));
+ BUG_ON(PageLocked(page));
+ BUG_ON(PageLRU(page));
+ BUG_ON(PageActive(page));
+ BUG_ON(PageDirty(page));
+ BUG_ON(PageWriteback(page));
+ }
BUG_ON(page->pte.direct != 0);
page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
1 << PG_referenced | 1 << PG_arch_1 |
-
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/
This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:57 EST