linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Carsten Otte <cotte@de.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Memory Management List <linux-mm@kvack.org>,
	Nick Piggin <npiggin@suse.de>,
	schwidefsky@de.ibm.com, holger.wolf@de.ibm.com
Subject: [patch] #ifdef very expensive debug check in page fault path
Date: Wed, 16 Jan 2008 19:01:28 +0100	[thread overview]
Message-ID: <1200506488.32116.11.camel@cotte.boeblingen.de.ibm.com> (raw)

This patch puts #ifdef CONFIG_DEBUG_VM around a check in vm_normal_page
that verifies that a pfn is valid. This patch increases performance of
the page fault microbenchmark in lmbench by 13% and overall dbench
performance by 7% on s390x.  pfn_valid() is an expensive operation on
s390 that needs a high double digit amount of CPU cycles.
Nick Piggin suggested that pfn_valid() involves an array lookup on
systems with sparsemem, and therefore is an expensive operation there
too.
The check looks like a clear debug thing to me, it should never trigger
on regular kernels. And if a pte is created for an invalid pfn, we'll
find out once the memory gets accessed later on anyway. Please consider
inclusion of this patch into mm.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
--- 
Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c
+++ linux-2.6/mm/memory.c
@@ -392,6 +392,7 @@ struct page *vm_normal_page(struct vm_ar
 			return NULL;
 	}
 
+#ifdef CONFIG_DEBUG_VM
 	/*
 	 * Add some anal sanity checks for now. Eventually,
 	 * we should just do "return pfn_to_page(pfn)", but
@@ -402,6 +403,7 @@ struct page *vm_normal_page(struct vm_ar
 		print_bad_pte(vma, pte, addr);
 		return NULL;
 	}
+#endif
 
 	/*
 	 * NOTE! We still have PageReserved() pages in the page 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2008-01-16 18:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16 18:01 Carsten Otte [this message]
2008-01-16 23:45 ` Nick Piggin
2008-01-17  0:10   ` Andrew Morton
2008-01-17  0:27     ` Nick Piggin
2008-01-18 20:56     ` Hugh Dickins
2008-01-21  9:45       ` Carsten Otte
2008-01-22 22:35         ` Hugh Dickins
2008-01-22 23:39           ` Nick Piggin
2008-01-23  0:02             ` Hugh Dickins
2008-01-23  9:14           ` Martin Schwidefsky
2008-01-17  9:53   ` Martin Schwidefsky
2008-01-18  4:09     ` Nick Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1200506488.32116.11.camel@cotte.boeblingen.de.ibm.com \
    --to=cotte@de.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=holger.wolf@de.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox