linux virtual memory pagesize

A page is a fixed length block of main memory, which is contiguous in both physical memory addressing and virtual memory addressing. The kernel swaps and allocates memory using pages. The command to know the PAGESIZE is :

  • # getconf PAGESIZE

The result will be as follow :

Linux VM pagesize

We can also use time command to find out the actual PAGESIZE in the server (you need to install the time rpm package to get the list)

  • # yum install time

Execute the following command.

  • # /usr/bin/time -v date

Linux VM pagesize

Major and Minor Page Faults

When an application starts,the kernel searches the CPU caches and then physical memory. If the data does not exist in either, the kernel issues a major page fault (MPF). A MPF is a request to the disk subsystem to retrieve pages off disk and buffer them in RAM.
Once memory pages are mapped into the buffer cache, the kernel will attempt to use these pages resulting in a minor page fault (MnPF). A MnPF saves the kernel time by reusing a page in memory as opposed to placing it back on the disk.

In the following example, the time command is used to demonstrate how many MPF and MnPF occurred when an application started. The first time the application starts, there are many MPFs:

  • # /usr/bin/time -v evolution

Minor-Major pagefault

The second time evolution starts, the kernel does not issue any MPFs because the application is in memory already:

Minor-major pagefault