Re: kernel page size explanation

From: Jesper Juhl
Date: Thu Jul 21 2005 - 20:21:52 EST


On 7/22/05, Gaspar Bakos <gbakos@xxxxxxxxxxxxxxx> wrote:
> Hi,
>
> Sorry for this nursery-school question.
>
> Could someone briefly explain me :
> 1. what is the kernel page size (any _useful_ pointer on the web is fine),

Depends on arch. Take a look at PAGE_SIZE and PAGE_SHIFT - look in
include/asm-*/page.h
Here's a nice web interface for browsing the source and quickly
finding the info you need :) : http://lxr.linux.no/ident?i=PAGE_SIZE

> 2. how can one tune it (for 2.6.*)?

For some archs the page size can be set at compile-time with
CONFIG_PAGE_SIZE_4KB, CONFIG_PAGE_SIZE_8KB etc - mips is an example of
such an arch (also take a look at CONFIG_HUGETLB_PAGE and friends).

> 3. what kind of effect does it have on system performance, if it is
> tuneable, and if it worth changing this at all?
>
Depends on your workload.

> I am a bit confused; at one place i see someone saying that the kernel
> page size is 4kb for i386.
> At another place I see a statement:
> "I tried all four possible page sizes on Itanium (4k, 8k, 16k and 64k)"
>
That makes perfect sense - i386 uses a 4K page size, ia64 is one of
the archs that support different page sizes (via
CONFIG_IA64_PAGE_SIZE_* ).
some i386 machines can also use 4MB pages IIRC, but I don't think
Linux lets you configure that for i386, but I'm not entirely sure.

> How can i figure out the page size of the kernel i am currently using?
>
You can
A) look in the .config file for your current kernel (if your arch
supports different page sizes at all).
B) You can use the getpagesize(2) syscall at runtime. getpagesize()
returns the nr of bytes in a page - man getpagesize - I'm not sure
that's universally supported though.
C) You can look at /proc/cpuinfo or /proc/meminfo , IIRC some archs
report page size there - not quite sure, can't remember...


--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/