public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jes Sorensen <jes@sgi.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	bjorn_helgaas@hp.com, Nick Piggin <nickpiggin@yahoo.com.au>,
	Robin Holt <holt@sgi.com>, Dean Nelson <dcn@sgi.com>,
	Hugh Dickins <hugh@veritas.com>
Subject: Re: [patch] do_no_pfn()
Date: Fri, 22 Sep 2006 12:49:40 -0700	[thread overview]
Message-ID: <20060922124940.5ca5ee87.akpm@osdl.org> (raw)
In-Reply-To: <yq0u033c84a.fsf@jaguar.mkp.net>

On 20 Sep 2006 03:25:25 -0400
Jes Sorensen <jes@sgi.com> wrote:

> Implement do_no_pfn() for handling mapping of memory without a struct
> page backing it. This avoids creating fake page table entries for
> regions which are not backed by real memory.
> 
> This feature is used by the MSPEC driver and other users, where it is
> highly undesirable to have a struct page sitting behind the page
> (for instance if the page is accessed in cached mode via the struct
> page in parallel to the the driver accessing it uncached, which can
> result in data corruption on some architectures, such as ia64).
> 
> This version uses specific NOPFN_{SIGBUS,OOM} return values, rather
> than expect all negative pfn values would be an error. It also bugs on
> cow mappings as this would not work with the VM.


How does this followup look?


We don't want the rarely-used do_no_pfn() to get inlined in the oft-used
handle_pte_fault(), using up icache.  Mark it noinline and unlikely.


--- a/mm/memory.c~do_no_pfn-tweaks
+++ a/mm/memory.c
@@ -2276,8 +2276,10 @@ oom:
  *
  * It is expected that the ->nopfn handler always returns the same pfn
  * for a given virtual mapping.
+ *
+ * Mark this `noinline' to prevent it from bloating the main pagefault code.
  */
-static int do_no_pfn(struct mm_struct *mm, struct vm_area_struct *vma,
+static noinline int do_no_pfn(struct mm_struct *mm, struct vm_area_struct *vma,
 		     unsigned long address, pte_t *page_table, pmd_t *pmd,
 		     int write_access)
 {
@@ -2376,7 +2378,7 @@ static inline int handle_pte_fault(struc
 					return do_no_page(mm, vma, address,
 							  pte, pmd,
 							  write_access);
-				if (vma->vm_ops->nopfn)
+				if (unlikely(vma->vm_ops->nopfn))
 					return do_no_pfn(mm, vma, address, pte,
 							 pmd, write_access);
 			}
_


  parent reply	other threads:[~2006-09-22 19:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-20  4:33 Arrr! Linux 2.6.18 Linus Torvalds
2006-09-20  4:59 ` Michal Piotrowski
2006-09-20  7:25 ` [patch] do_no_pfn() Jes Sorensen
2006-09-20 15:46   ` Randy.Dunlap
2006-09-20 16:47     ` Jes Sorensen
2006-09-22 19:49   ` Andrew Morton [this message]
2006-09-25  9:31     ` Jes Sorensen
2006-09-22 21:51 ` Arrr! Linux 2.6.18 Judith Lebzelter
2006-09-22 22:08   ` Jeff Garzik
2006-09-22 22:57     ` Dale Farnsworth
2006-09-22 22:58       ` Jeff Garzik
2006-09-29  8:36 ` Mark Lord
2006-09-29 14:49   ` Linus Torvalds
2006-09-29  8:40 ` Mark Lord
2006-09-29  8:44   ` Andrew Morton
2006-09-29 17:52     ` Mark Lord
2006-09-29 19:42       ` Rafael J. Wysocki
2006-09-29 19:58       ` Mark Lord

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=20060922124940.5ca5ee87.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=bjorn_helgaas@hp.com \
    --cc=dcn@sgi.com \
    --cc=holt@sgi.com \
    --cc=hugh@veritas.com \
    --cc=jes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=torvalds@osdl.org \
    /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