public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	Chris Wright <chrisw@osdl.org>, Martin Bligh <mbligh@mbligh.org>,
	Pratap Subrahmanyam <pratap@vmware.com>,
	Christopher Li <chrisl@vmware.com>,
	Zachary Amsden <zach@vmware.com>,
	Zachary Amsden <zach@vmware.com>
Subject: [PATCH 2/2] Use page present for pae pdpes
Date: Wed, 31 Aug 2005 14:51:48 -0700	[thread overview]
Message-ID: <200508312151.j7VLpmu8003144@zach-dev.vmware.com> (raw)

Ok, the use of "1 + " and subtraction of one for PAE PDPEs has confused
many people now.  Make it explicit what is going on and why anding with
PAGE_MASK is a better idea to strip these bits.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Depends-on: add-pgtable-allocation-notifiers
Index: linux-2.6.13/arch/i386/mm/pgtable.c
===================================================================
--- linux-2.6.13.orig/arch/i386/mm/pgtable.c	2005-08-31 14:48:17.000000000 -0700
+++ linux-2.6.13/arch/i386/mm/pgtable.c	2005-08-31 14:48:53.000000000 -0700
@@ -247,14 +247,14 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
 		if (!pmd)
 			goto out_oom;
 		SetPagePDE(virt_to_page(pmd));
-		set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
+		set_pgd(&pgd[i], __pgd(_PAGE_PRESENT | __pa(pmd)));
 	}
 	return pgd;
 
 out_oom:
 	for (i--; i >= 0; i--) {
 		ClearPagePDE(pfn_to_page(pgd_val(pgd[i]) >> PAGE_SHIFT));
-		kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1));
+		kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i]) & PAGE_MASK));
 	}
 	kmem_cache_free(pgd_cache, pgd);
 	return NULL;
@@ -268,7 +268,7 @@ void pgd_free(pgd_t *pgd)
 	if (PTRS_PER_PMD > 1)
 		for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
 			ClearPagePDE(pfn_to_page(pgd_val(pgd[i]) >> PAGE_SHIFT));
-			kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1));
+			kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i]) & PAGE_MASK));
 		}
 	/* in the non-PAE case, free_pgtables() clears user pgd entries */
 	kmem_cache_free(pgd_cache, pgd);
Index: linux-2.6.13/arch/i386/mm/init.c
===================================================================
--- linux-2.6.13.orig/arch/i386/mm/init.c	2005-08-31 14:48:17.000000000 -0700
+++ linux-2.6.13/arch/i386/mm/init.c	2005-08-31 14:48:53.000000000 -0700
@@ -387,7 +387,7 @@ void zap_low_mappings (void)
 	 */
 	for (i = 0; i < USER_PTRS_PER_PGD; i++)
 #ifdef CONFIG_X86_PAE
-		set_pgd(swapper_pg_dir+i, __pgd(1 + __pa(empty_zero_page)));
+		set_pgd(swapper_pg_dir+i, __pgd(_PAGE_PRESENT | __pa(empty_zero_page)));
 #else
 		set_pgd(swapper_pg_dir+i, __pgd(0));
 #endif

                 reply	other threads:[~2005-08-31 21:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200508312151.j7VLpmu8003144@zach-dev.vmware.com \
    --to=zach@vmware.com \
    --cc=akpm@osdl.org \
    --cc=chrisl@vmware.com \
    --cc=chrisw@osdl.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@mbligh.org \
    --cc=pratap@vmware.com \
    --cc=virtualization@lists.osdl.org \
    --cc=zwane@arm.linux.org.uk \
    /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