mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] fewer unlikely tests
  2002-10-15 21:11 [PATCH] fewer unlikely tests Hugh Dickins
@ 2002-10-15 21:11 ` William Lee Irwin III
  2002-10-16  0:40 ` David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: William Lee Irwin III @ 2002-10-15 21:11 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrew Morton, linux-kernel

On Tue, Oct 15, 2002 at 10:11:44PM +0100, Hugh Dickins wrote:
> 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.

Reasonable and straightforward IMHO.


Bill

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] fewer unlikely tests
@ 2002-10-15 21:11 Hugh Dickins
  2002-10-15 21:11 ` William Lee Irwin III
  2002-10-16  0:40 ` David S. Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Hugh Dickins @ 2002-10-15 21:11 UTC (permalink / raw)
  To: Andrew Morton; +Cc: William Lee Irwin III, linux-kernel

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 |


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fewer unlikely tests
  2002-10-15 21:11 [PATCH] fewer unlikely tests Hugh Dickins
  2002-10-15 21:11 ` William Lee Irwin III
@ 2002-10-16  0:40 ` David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2002-10-16  0:40 UTC (permalink / raw)
  To: hugh; +Cc: akpm, wli, linux-kernel

   From: Hugh Dickins <hugh@veritas.com>
   Date: Tue, 15 Oct 2002 22:11:44 +0100 (BST)

   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.

I definitely like this change.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-16  0:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-15 21:11 [PATCH] fewer unlikely tests Hugh Dickins
2002-10-15 21:11 ` William Lee Irwin III
2002-10-16  0:40 ` David S. Miller

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®