linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: "'Dave McCracken'" <dmccr@us.ibm.com>, "Andrew Morton" <akpm@osdl.org>
Cc: "Linux Kernel" <linux-kernel@vger.kernel.org>,
	"Linux Memory Management" <linux-mm@kvack.org>
Subject: RE: [PATCH 1/1] Implement shared page tables
Date: Thu, 1 Sep 2005 18:58:23 -0700	[thread overview]
Message-ID: <200509020158.j821wtg00465@unix-os.sc.intel.com> (raw)
In-Reply-To: <7C49DFF721CB4E671DB260F9@[10.1.1.4]>

Dave McCracken wrote on Tuesday, August 30, 2005 3:13 PM
> This patch implements page table sharing for all shared memory regions that
> span an entire page table page.  It supports sharing at multiple page
> levels, depending on the architecture.
> 
> 
> This version of the patch supports i386 and x86_64.  I have additional
> patches to support ppc64, but they are not quite ready for public
> consumption.
> 
>  ....
> +		prio_tree_iter_init(&iter, &mapping->i_mmap,
> +				    vma->vm_start, vma->vm_end);


I think this is a bug.  The radix priority tree for address_space->
i_mmap is keyed on vma->vm_pgoff.  Your patch uses the vma virtual
address to find a shareable range, Which will always fail a match
even though there is one.  The following is a quick hack I did to
make it work.

- Ken

--- linux-2.6.13/mm/ptshare.c.orig	2005-09-01 18:58:12.299321918 -0700
+++ linux-2.6.13/mm/ptshare.c	2005-09-01 18:58:39.846196580 -0700
@@ -26,6 +26,11 @@
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 
+#define RADIX_INDEX(vma)  ((vma)->vm_pgoff)
+#define VMA_SIZE(vma)	  (((vma)->vm_end - (vma)->vm_start) >> PAGE_SHIFT)
+/* avoid overflow */
+#define HEAP_INDEX(vma)	  ((vma)->vm_pgoff + (VMA_SIZE(vma) - 1))
+
 #undef	PT_DEBUG
 
 #ifndef __PAGETABLE_PMD_FOLDED
@@ -173,7 +178,7 @@ pt_share_pte(struct vm_area_struct *vma,
 		       address);
 #endif
 		prio_tree_iter_init(&iter, &mapping->i_mmap,
-				    vma->vm_start, vma->vm_end);
+				    RADIX_INDEX(vma), HEAP_INDEX(vma));
 
 		while ((svma = next_shareable_vma(vma, svma, &iter))) {
 			spgd = pgd_offset(svma->vm_mm, address);



  parent reply	other threads:[~2005-09-02  1:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-30 22:13 [PATCH 1/1] Implement shared page tables Dave McCracken
2005-08-31 11:44 ` Hugh Dickins
2005-08-31 11:51   ` Arjan van de Ven
2005-08-31 13:42     ` Hugh Dickins
2005-08-31 14:31       ` Martin J. Bligh
2005-08-31 14:41         ` Arjan van de Ven
2005-08-31 15:06         ` Hugh Dickins
2005-08-31 15:39           ` Martin J. Bligh
2005-08-31 16:40   ` Dave McCracken
2005-09-02  1:58 ` Chen, Kenneth W [this message]
2005-09-02 16:40   ` Dave McCracken
2005-09-02  4:26 ` Chen, Kenneth W

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=200509020158.j821wtg00465@unix-os.sc.intel.com \
    --to=kenneth.w.chen@intel.com \
    --cc=akpm@osdl.org \
    --cc=dmccr@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).