public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PPC64] Remove LARGE_PAGE_SHIFT constant
@ 2004-09-17  1:13 David Gibson
  2004-09-17 17:03 ` Marcelo Tosatti
  0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2004-09-17  1:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Anton Blanchard, Paul Mackerras, linuxppc64-dev, linux-kernel

Andrew, please apply:

For historical reasons, ppc64 has ended up with two #defines for the
size of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT.  This
patch removes LARGE_PAGE_SHIFT in favour of the more widely used
HPAGE_SHIFT.

Signed-off-by: David Gibson <dwg@au1.ibm.com>

Index: working-2.6/arch/ppc64/kernel/pSeries_htab.c
===================================================================
--- working-2.6.orig/arch/ppc64/kernel/pSeries_htab.c	2004-08-09 09:51:38.000000000 +1000
+++ working-2.6/arch/ppc64/kernel/pSeries_htab.c	2004-09-16 17:04:56.034685808 +1000
@@ -325,7 +325,7 @@
 		va = (vsid << 28) | (batch->addr[i] & 0x0fffffff);
 		batch->vaddr[j] = va;
 		if (large)
-			vpn = va >> LARGE_PAGE_SHIFT;
+			vpn = va >> HPAGE_SHIFT;
 		else
 			vpn = va >> PAGE_SHIFT;
 		hash = hpt_hash(vpn, large);
Index: working-2.6/include/asm-ppc64/mmu.h
===================================================================
--- working-2.6.orig/include/asm-ppc64/mmu.h	2004-09-16 16:58:48.170699448 +1000
+++ working-2.6/include/asm-ppc64/mmu.h	2004-09-16 17:04:44.306603944 +1000
@@ -119,8 +119,6 @@
 #define PT_SHIFT (12)			/* Page Table */
 #define PT_MASK  0x02FF
 
-#define LARGE_PAGE_SHIFT 24
-
 static inline unsigned long hpt_hash(unsigned long vpn, int large)
 {
 	unsigned long vsid;
Index: working-2.6/arch/ppc64/mm/hash_utils.c
===================================================================
--- working-2.6.orig/arch/ppc64/mm/hash_utils.c	2004-09-15 10:53:53.000000000 +1000
+++ working-2.6/arch/ppc64/mm/hash_utils.c	2004-09-16 17:04:20.121686024 +1000
@@ -100,7 +100,7 @@
 		int ret;
 
 		if (large)
-			vpn = va >> LARGE_PAGE_SHIFT;
+			vpn = va >> HPAGE_SHIFT;
 		else
 			vpn = va >> PAGE_SHIFT;
 
@@ -332,7 +332,7 @@
 
 	va = (vsid << 28) | (ea & 0x0fffffff);
 	if (large)
-		vpn = va >> LARGE_PAGE_SHIFT;
+		vpn = va >> HPAGE_SHIFT;
 	else
 		vpn = va >> PAGE_SHIFT;
 	hash = hpt_hash(vpn, large);
Index: working-2.6/arch/ppc64/mm/hugetlbpage.c
===================================================================
--- working-2.6.orig/arch/ppc64/mm/hugetlbpage.c	2004-09-07 10:38:00.000000000 +1000
+++ working-2.6/arch/ppc64/mm/hugetlbpage.c	2004-09-16 17:03:34.673672800 +1000
@@ -853,7 +853,7 @@
 	vsid = get_vsid(context.id, ea);
 
 	va = (vsid << 28) | (ea & 0x0fffffff);
-	vpn = va >> LARGE_PAGE_SHIFT;
+	vpn = va >> HPAGE_SHIFT;
 	hash = hpt_hash(vpn, 1);
 	if (hugepte_val(pte) & _HUGEPAGE_SECONDARY)
 		hash = ~hash;

-- 
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

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

* Re: [PPC64] Remove LARGE_PAGE_SHIFT constant
  2004-09-17  1:13 [PPC64] Remove LARGE_PAGE_SHIFT constant David Gibson
@ 2004-09-17 17:03 ` Marcelo Tosatti
  2004-09-17 18:40   ` Dave Hansen
  2004-09-17 23:46   ` David Gibson
  0 siblings, 2 replies; 7+ messages in thread
From: Marcelo Tosatti @ 2004-09-17 17:03 UTC (permalink / raw)
  To: David Gibson, Andrew Morton, Anton Blanchard, Paul Mackerras,
	linuxppc64-dev, linux-kernel

On Fri, Sep 17, 2004 at 11:13:20AM +1000, David Gibson wrote:
> Andrew, please apply:
> 
> For historical reasons, ppc64 has ended up with two #defines for the
> size of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT.  This
> patch removes LARGE_PAGE_SHIFT in favour of the more widely used
> HPAGE_SHIFT.

Nitpicking, "LARGE_PAGE_xxx" is used by x86/x86_64:

#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)

Wouldnt it be nice to keep consistency between archs?

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

* Re: [PPC64] Remove LARGE_PAGE_SHIFT constant
  2004-09-17 18:40   ` Dave Hansen
@ 2004-09-17 17:33     ` Marcelo Tosatti
  2004-09-17 23:43       ` David Gibson
  2004-09-17 21:23     ` Paul Mackerras
  1 sibling, 1 reply; 7+ messages in thread
From: Marcelo Tosatti @ 2004-09-17 17:33 UTC (permalink / raw)
  To: Dave Hansen
  Cc: David Gibson, Andrew Morton, Anton Blanchard, Paul Mackerras,
	linuxppc64-dev, Linux Kernel Mailing List

On Fri, Sep 17, 2004 at 11:40:29AM -0700, Dave Hansen wrote:
> On Fri, 2004-09-17 at 10:03, Marcelo Tosatti wrote:
> > On Fri, Sep 17, 2004 at 11:13:20AM +1000, David Gibson wrote:
> > > Andrew, please apply:
> > > 
> > > For historical reasons, ppc64 has ended up with two #defines for the
> > > size of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT.  This
> > > patch removes LARGE_PAGE_SHIFT in favour of the more widely used
> > > HPAGE_SHIFT.
> > 
> > Nitpicking, "LARGE_PAGE_xxx" is used by x86/x86_64:
> > 
> > #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
> > #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
> > 
> > Wouldnt it be nice to keep consistency between archs?
> 
> Actually, if everybody makes sure to define PMD_SHIFT, we should be able
> to use common macros, right?

Yeap. 

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

* Re: [PPC64] Remove LARGE_PAGE_SHIFT constant
  2004-09-17 17:03 ` Marcelo Tosatti
@ 2004-09-17 18:40   ` Dave Hansen
  2004-09-17 17:33     ` Marcelo Tosatti
  2004-09-17 21:23     ` Paul Mackerras
  2004-09-17 23:46   ` David Gibson
  1 sibling, 2 replies; 7+ messages in thread
From: Dave Hansen @ 2004-09-17 18:40 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: David Gibson, Andrew Morton, Anton Blanchard, Paul Mackerras,
	linuxppc64-dev, Linux Kernel Mailing List

On Fri, 2004-09-17 at 10:03, Marcelo Tosatti wrote:
> On Fri, Sep 17, 2004 at 11:13:20AM +1000, David Gibson wrote:
> > Andrew, please apply:
> > 
> > For historical reasons, ppc64 has ended up with two #defines for the
> > size of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT.  This
> > patch removes LARGE_PAGE_SHIFT in favour of the more widely used
> > HPAGE_SHIFT.
> 
> Nitpicking, "LARGE_PAGE_xxx" is used by x86/x86_64:
> 
> #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
> #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
> 
> Wouldnt it be nice to keep consistency between archs?

Actually, if everybody makes sure to define PMD_SHIFT, we should be able
to use common macros, right?

-- Dave


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

* Re: [PPC64] Remove LARGE_PAGE_SHIFT constant
  2004-09-17 18:40   ` Dave Hansen
  2004-09-17 17:33     ` Marcelo Tosatti
@ 2004-09-17 21:23     ` Paul Mackerras
  1 sibling, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2004-09-17 21:23 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Marcelo Tosatti, David Gibson, Andrew Morton, Anton Blanchard,
	linuxppc64-dev, Linux Kernel Mailing List

Dave Hansen writes:

> Actually, if everybody makes sure to define PMD_SHIFT, we should be able
> to use common macros, right?

No, because LARGE_PAGE_SHIFT != PMD_SHIFT on ppc64.

Paul.

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

* Re: [PPC64] Remove LARGE_PAGE_SHIFT constant
  2004-09-17 17:33     ` Marcelo Tosatti
@ 2004-09-17 23:43       ` David Gibson
  0 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2004-09-17 23:43 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Dave Hansen, Andrew Morton, Anton Blanchard, Paul Mackerras,
	linuxppc64-dev, Linux Kernel Mailing List

On Fri, Sep 17, 2004 at 02:33:34PM -0300, Marcelo Tosatti wrote:
> On Fri, Sep 17, 2004 at 11:40:29AM -0700, Dave Hansen wrote:
> > On Fri, 2004-09-17 at 10:03, Marcelo Tosatti wrote:
> > > On Fri, Sep 17, 2004 at 11:13:20AM +1000, David Gibson wrote:
> > > > Andrew, please apply:
> > > > 
> > > > For historical reasons, ppc64 has ended up with two #defines for the
> > > > size of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT.  This
> > > > patch removes LARGE_PAGE_SHIFT in favour of the more widely used
> > > > HPAGE_SHIFT.
> > > 
> > > Nitpicking, "LARGE_PAGE_xxx" is used by x86/x86_64:
> > > 
> > > #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
> > > #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
> > > 
> > > Wouldnt it be nice to keep consistency between archs?
> > 
> > Actually, if everybody makes sure to define PMD_SHIFT, we should be able
> > to use common macros, right?
> 
> Yeap. 

No.  The large page shift is not necessarily the same as the
PMD_SHIFT.  It's the same on x86, but it is less on sparc64 and sh,
and greater on ppc64.

-- 
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

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

* Re: [PPC64] Remove LARGE_PAGE_SHIFT constant
  2004-09-17 17:03 ` Marcelo Tosatti
  2004-09-17 18:40   ` Dave Hansen
@ 2004-09-17 23:46   ` David Gibson
  1 sibling, 0 replies; 7+ messages in thread
From: David Gibson @ 2004-09-17 23:46 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Andrew Morton, Anton Blanchard, Paul Mackerras, linuxppc64-dev,
	linux-kernel

On Fri, Sep 17, 2004 at 02:03:28PM -0300, Marcelo Tosatti wrote:
> On Fri, Sep 17, 2004 at 11:13:20AM +1000, David Gibson wrote:
> > Andrew, please apply:
> > 
> > For historical reasons, ppc64 has ended up with two #defines for the
> > size of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT.  This
> > patch removes LARGE_PAGE_SHIFT in favour of the more widely used
> > HPAGE_SHIFT.
> 
> Nitpicking, "LARGE_PAGE_xxx" is used by x86/x86_64:
> 
> #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
> #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
> 
> Wouldnt it be nice to keep consistency between archs?

Hrm... they are indeed there.  However *all* archs, including x86 and
x86_64 have HPAGE_SHIFT et al - it's used in generic code, so x86 has
the duplicate #defines as well.

Actually.. I guess the distinction is that LARGE_PAGE_* refer to the
hardware large page size, whereas HPAGE_SIZE refers to the software
page size used for hugetlbfs.  I think those are identical for all
arches at the moment, but they wouldn't have to be.

-- 
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

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

end of thread, other threads:[~2004-09-18  7:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-17  1:13 [PPC64] Remove LARGE_PAGE_SHIFT constant David Gibson
2004-09-17 17:03 ` Marcelo Tosatti
2004-09-17 18:40   ` Dave Hansen
2004-09-17 17:33     ` Marcelo Tosatti
2004-09-17 23:43       ` David Gibson
2004-09-17 21:23     ` Paul Mackerras
2004-09-17 23:46   ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox