Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-13 Thread Helge Hafting

Yoav Artzi wrote:
According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB. 
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's 
at least the way I understand it. However, looking at the kernel code 
of x86_64, I see the PAGE_SIZE is 4KB.



Can anyone explain to me what am I missing here?

Only that there are no connection at all between the page size and
the number of bits the processor uses.


The cpu designer simply makes independent decisions for both cases.
So i386 uses 4kB pages because intel designed their processor that way.
And x86_64 uses 4kB pages because AMD designed the architecture that way.
And some processors use 8kB or 16kB pages because that is how they work.
A few  processors offer a selection of page sizes, it is then up to the
architecture maintainer to make a choice between them. No such choice
exists for intel/amd, unless you count the unrealistic option
of using generic 2MB pages.

Having said that, it is possible to get a feel of what a 8kB page system
will be like on intel, by always allocating pages in pairs.

Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-13 Thread Helge Hafting

Yoav Artzi wrote:
According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB. 
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's 
at least the way I understand it. However, looking at the kernel code 
of x86_64, I see the PAGE_SIZE is 4KB.



Can anyone explain to me what am I missing here?

Only that there are no connection at all between the page size and
the number of bits the processor uses.


The cpu designer simply makes independent decisions for both cases.
So i386 uses 4kB pages because intel designed their processor that way.
And x86_64 uses 4kB pages because AMD designed the architecture that way.
And some processors use 8kB or 16kB pages because that is how they work.
A few  processors offer a selection of page sizes, it is then up to the
architecture maintainer to make a choice between them. No such choice
exists for intel/amd, unless you count the unrealistic option
of using generic 2MB pages.

Having said that, it is possible to get a feel of what a 8kB page system
will be like on intel, by always allocating pages in pairs.

Helge Hafting
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Chris Snook

Yoav Artzi wrote:
According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB. 
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at 
least the way I understand it. However, looking at the kernel code of 
x86_64, I see the PAGE_SIZE is 4KB.



Can anyone explain to me what am I missing here?


PAGE_SIZE is highly architecture-dependent.  While it is true that 4K pages are 
typical on 32-bit architectures, and 64-bit architectures have historically 
introduced 8K pages, this is by no means a requirement.  x86_64 uses the same 
page sizes that are available on i686+PAE, so you get 4K base pages.  alpha and 
sparc64 typically use 8K base pages, though they have other options as well. 
ia64 defaults to 16K, though it can do 4K, 8K, and a bunch of larger base sizes. 
 ppc64 does 4K and 64K.  s390 uses 4K base pages in both 31-bit and 64-bit 
kernels.  If x86_64 processors are released with TLBs that can handle 8K pages, 
it'll be straightforward to add that feature, but otherwise it would require 
faking it in software, which has lots of pitfalls and does nothing to improve 
TLB efficiency.


-- Chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Kyle McMartin
On Mon, Nov 12, 2007 at 05:58:08PM +0200, Yoav Artzi wrote:
> Looking at the source, I see:
> 
> #ifdef CONFIG_4KSTACKS
> #define THREAD_SIZE(4096)
> #else
> #define THREAD_SIZE(8192)
> #endif
> 
> 
> So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel 
> stack. Am I missing something here?
> 

This is only on i386 (32-bit x86...)[1] On x86-64, we have 8K kernel
stacks (THREAD_ORDER 1), and 16K irqstacks (IRQSTACK_ORDER 2).

The relevant defines are found in  for x86_64, and
 for i386.

Cheers,
Kyle

1. That is, stack size is only configurable on 32bit.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi

I see. Thanks, guys.


 Original Message  

Subject: Re: PAGE_SIZE on 64bit and 32bit machines
From: Kyle McMartin <[EMAIL PROTECTED]>
To: Yoav Artzi <[EMAIL PROTECTED]>
Date: Monday, November 12, 2007 6:11:06 PM


On Mon, Nov 12, 2007 at 05:58:08PM +0200, Yoav Artzi wrote:
  

Looking at the source, I see:

#ifdef CONFIG_4KSTACKS
#define THREAD_SIZE(4096)
#else
#define THREAD_SIZE(8192)
#endif


So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel 
stack. Am I missing something here?





This is only on i386 (32-bit x86...)[1] On x86-64, we have 8K kernel
stacks (THREAD_ORDER 1), and 16K irqstacks (IRQSTACK_ORDER 2).

The relevant defines are found in  for x86_64, and
 for i386.

Cheers,
Kyle

1. That is, stack size is only configurable on 32bit.

Scanned by Check Point VPN-1 UTM NGX R65 with Messaging Security

  


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Jiri Slaby
On 11/12/2007 04:58 PM, Yoav Artzi wrote:
> Looking at the source, I see:
> 
> #ifdef CONFIG_4KSTACKS
> #define THREAD_SIZE(4096)
> #else
> #define THREAD_SIZE(8192)
> #endif
> 
> 
> So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel
> stack. Am I missing something here?

But it's not configurable on x86_64, where the thread size defaults to 8k.

regards,
-- 
Jiri Slaby ([EMAIL PROTECTED])
Faculty of Informatics, Masaryk University
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi

Looking at the source, I see:

#ifdef CONFIG_4KSTACKS
#define THREAD_SIZE(4096)
#else
#define THREAD_SIZE(8192)
#endif


So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel 
stack. Am I missing something here?



 Original Message  

Subject: Re: PAGE_SIZE on 64bit and 32bit machines
From: Adrian Bunk <[EMAIL PROTECTED]>
To: Yoav Artzi <[EMAIL PROTECTED]>
Date: Monday, November 12, 2007 5:39:08 PM


On Mon, Nov 12, 2007 at 05:32:36PM +0200, Yoav Artzi wrote:

  

Well, since the size of the kernel stack is one page,
...



That's not true.

cu
Adrian

  


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Adrian Bunk
On Mon, Nov 12, 2007 at 05:32:36PM +0200, Yoav Artzi wrote:

> Well, since the size of the kernel stack is one page,
>...

That's not true.

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi
Well, since the size of the kernel stack is one page, I figured it will 
grow when switching to 64-bit, because some of the types grow and a 
similar flow/stack will be bigger in 64-bit in comparison to 32-bit.


Keeping the page size at 4kb and so keeping the stack at 4kb is a bit 
dangerous. Isn't it?


I know that using one page for a kernel stack is a optional feature, but:

a) It's a good feature

b) It's already used by major distros, e.g. Red Hat



 Original Message  

Subject: Re: PAGE_SIZE on 64bit and 32bit machines
From: Jiri Slaby <[EMAIL PROTECTED]>
To: Yoav Artzi <[EMAIL PROTECTED]>
Date: Monday, November 12, 2007 5:14:17 PM


On 11/12/2007 03:39 PM, Yoav Artzi wrote:
  

According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB.
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at
least the way I understand it. However, looking at the kernel code of
x86_64, I see the PAGE_SIZE is 4KB.



Yes, it stood unchanged, the only difference is 4-level page tables.

  

Can anyone explain to me what am I missing here?



What led you to that it must be 8k?

regards,
  


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Jiri Slaby
On 11/12/2007 03:39 PM, Yoav Artzi wrote:
> According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB.
> Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at
> least the way I understand it. However, looking at the kernel code of
> x86_64, I see the PAGE_SIZE is 4KB.

Yes, it stood unchanged, the only difference is 4-level page tables.

> Can anyone explain to me what am I missing here?

What led you to that it must be 8k?

regards,
-- 
Jiri Slaby ([EMAIL PROTECTED])
Faculty of Informatics, Masaryk University
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi
According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB. 
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at 
least the way I understand it. However, looking at the kernel code of 
x86_64, I see the PAGE_SIZE is 4KB.



Can anyone explain to me what am I missing here?


Thanks

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi
According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB. 
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at 
least the way I understand it. However, looking at the kernel code of 
x86_64, I see the PAGE_SIZE is 4KB.



Can anyone explain to me what am I missing here?


Thanks

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Jiri Slaby
On 11/12/2007 03:39 PM, Yoav Artzi wrote:
 According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB.
 Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at
 least the way I understand it. However, looking at the kernel code of
 x86_64, I see the PAGE_SIZE is 4KB.

Yes, it stood unchanged, the only difference is 4-level page tables.

 Can anyone explain to me what am I missing here?

What led you to that it must be 8k?

regards,
-- 
Jiri Slaby ([EMAIL PROTECTED])
Faculty of Informatics, Masaryk University
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi
Well, since the size of the kernel stack is one page, I figured it will 
grow when switching to 64-bit, because some of the types grow and a 
similar flow/stack will be bigger in 64-bit in comparison to 32-bit.


Keeping the page size at 4kb and so keeping the stack at 4kb is a bit 
dangerous. Isn't it?


I know that using one page for a kernel stack is a optional feature, but:

a) It's a good feature

b) It's already used by major distros, e.g. Red Hat



 Original Message  

Subject: Re: PAGE_SIZE on 64bit and 32bit machines
From: Jiri Slaby [EMAIL PROTECTED]
To: Yoav Artzi [EMAIL PROTECTED]
Date: Monday, November 12, 2007 5:14:17 PM


On 11/12/2007 03:39 PM, Yoav Artzi wrote:
  

According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB.
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at
least the way I understand it. However, looking at the kernel code of
x86_64, I see the PAGE_SIZE is 4KB.



Yes, it stood unchanged, the only difference is 4-level page tables.

  

Can anyone explain to me what am I missing here?



What led you to that it must be 8k?

regards,
  


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Adrian Bunk
On Mon, Nov 12, 2007 at 05:32:36PM +0200, Yoav Artzi wrote:

 Well, since the size of the kernel stack is one page,
...

That's not true.

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi

Looking at the source, I see:

#ifdef CONFIG_4KSTACKS
#define THREAD_SIZE(4096)
#else
#define THREAD_SIZE(8192)
#endif


So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel 
stack. Am I missing something here?



 Original Message  

Subject: Re: PAGE_SIZE on 64bit and 32bit machines
From: Adrian Bunk [EMAIL PROTECTED]
To: Yoav Artzi [EMAIL PROTECTED]
Date: Monday, November 12, 2007 5:39:08 PM


On Mon, Nov 12, 2007 at 05:32:36PM +0200, Yoav Artzi wrote:

  

Well, since the size of the kernel stack is one page,
...



That's not true.

cu
Adrian

  


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Jiri Slaby
On 11/12/2007 04:58 PM, Yoav Artzi wrote:
 Looking at the source, I see:
 
 #ifdef CONFIG_4KSTACKS
 #define THREAD_SIZE(4096)
 #else
 #define THREAD_SIZE(8192)
 #endif
 
 
 So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel
 stack. Am I missing something here?

But it's not configurable on x86_64, where the thread size defaults to 8k.

regards,
-- 
Jiri Slaby ([EMAIL PROTECTED])
Faculty of Informatics, Masaryk University
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Yoav Artzi

I see. Thanks, guys.


 Original Message  

Subject: Re: PAGE_SIZE on 64bit and 32bit machines
From: Kyle McMartin [EMAIL PROTECTED]
To: Yoav Artzi [EMAIL PROTECTED]
Date: Monday, November 12, 2007 6:11:06 PM


On Mon, Nov 12, 2007 at 05:58:08PM +0200, Yoav Artzi wrote:
  

Looking at the source, I see:

#ifdef CONFIG_4KSTACKS
#define THREAD_SIZE(4096)
#else
#define THREAD_SIZE(8192)
#endif


So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel 
stack. Am I missing something here?





This is only on i386 (32-bit x86...)[1] On x86-64, we have 8K kernel
stacks (THREAD_ORDER 1), and 16K irqstacks (IRQSTACK_ORDER 2).

The relevant defines are found in asm-x86/page_64.h for x86_64, and
asm-x86/thread_info_32.h for i386.

Cheers,
Kyle

1. That is, stack size is only configurable on 32bit.

Scanned by Check Point VPN-1 UTM NGX R65 with Messaging Security

  


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Kyle McMartin
On Mon, Nov 12, 2007 at 05:58:08PM +0200, Yoav Artzi wrote:
 Looking at the source, I see:
 
 #ifdef CONFIG_4KSTACKS
 #define THREAD_SIZE(4096)
 #else
 #define THREAD_SIZE(8192)
 #endif
 
 
 So if I configure the option CONFIG_4KSTACK, I will get a 4KB kernel 
 stack. Am I missing something here?
 

This is only on i386 (32-bit x86...)[1] On x86-64, we have 8K kernel
stacks (THREAD_ORDER 1), and 16K irqstacks (IRQSTACK_ORDER 2).

The relevant defines are found in asm-x86/page_64.h for x86_64, and
asm-x86/thread_info_32.h for i386.

Cheers,
Kyle

1. That is, stack size is only configurable on 32bit.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PAGE_SIZE on 64bit and 32bit machines

2007-11-12 Thread Chris Snook

Yoav Artzi wrote:
According to my knowledge the PAGE_SIZE on 32bit architectures in 4KB. 
Logically, the PAGE_SIZE on 64bit architectures should be 8KB. That's at 
least the way I understand it. However, looking at the kernel code of 
x86_64, I see the PAGE_SIZE is 4KB.



Can anyone explain to me what am I missing here?


PAGE_SIZE is highly architecture-dependent.  While it is true that 4K pages are 
typical on 32-bit architectures, and 64-bit architectures have historically 
introduced 8K pages, this is by no means a requirement.  x86_64 uses the same 
page sizes that are available on i686+PAE, so you get 4K base pages.  alpha and 
sparc64 typically use 8K base pages, though they have other options as well. 
ia64 defaults to 16K, though it can do 4K, 8K, and a bunch of larger base sizes. 
 ppc64 does 4K and 64K.  s390 uses 4K base pages in both 31-bit and 64-bit 
kernels.  If x86_64 processors are released with TLBs that can handle 8K pages, 
it'll be straightforward to add that feature, but otherwise it would require 
faking it in software, which has lots of pitfalls and does nothing to improve 
TLB efficiency.


-- Chris
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/