Linux Find Out Virtual Memory PAGESIZE

by on January 2, 2008 · 16 comments· LAST UPDATED January 2, 2008

in , ,

Q. How do I check the size of PAGESIZE under Linux?

A. Most modern operating systems have their main memory divided into pages. It allows better utilization of memory. A page is a fixed length block of main memory, that is contiguous in both physical memory addressing and virtual memory addressing. Kernel swap and allocates memory using pages

To display size of a page in bytes, enter:
$ getconf PAGESIZE
OR
$ getconf PAGE_SIZE
Output:

4096
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 16 comments… read them below or add one }

1 oksander m-a January 13, 2009 at 4:31 pm

Can’t tell you how long I spent searching for this information. I knew it was simple and obvious, but I couldn’t remember it, so I could look it up! So many sites skip the command to get your page size. Points to you for having the info up and easy to parse.

Reply

2 Mit April 27, 2009 at 2:36 pm

Thanks. Nice info!

Reply

3 Segun June 2, 2009 at 10:17 am

Thanks for the sharp tip.

Reply

4 Hei July 16, 2009 at 8:06 am

Is there a way to change the page size?

Reply

5 wx672 October 20, 2011 at 6:07 am

Guess you have to change the kernel source.

In /usr/src/linux/include/asm-generic/page.h you can find the following lines:

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12

Reply

6 Flat February 14, 2011 at 11:21 am

getconf is nicer for sure, I found the answer on RHEL 5 this way:

man getpagesize

pointed me in this direction:
> cat test.c
#include
#include

int main(void)
{
int sz;
sz=getpagesize();
printf(“Page size: %d\n”,sz);
return 0;
}

> gcc -o test test.c
> ./test
Page size: 4096

Reply

7 lieven December 5, 2011 at 3:23 pm

is this MB or KB or GB??

Reply

8 person December 23, 2011 at 4:17 am

bytes

Reply

9 johnf February 1, 2012 at 4:12 am

I think it’s the base-2 logarithm of the page size. In other words, 2^PAGE_SHIFT is the page size. 2^12=4096, the usual page size in bytes

Reply

10 nidhi sogani February 28, 2012 at 3:36 pm

on running the calculation in gaussian linux programm i got error again and again….
Probably out of disk space. Write error in NtrExt
i search its meaning on net and found
Solution: /scratch space is most likely full. Delete old files in temporary folder…
please tell me how can do this…
plz

Reply

11 Martin March 6, 2013 at 11:34 am

Make sure you are looged in as root, then do

rm -rf /

That will free up some space.

Reply

12 az June 6, 2013 at 9:27 am

rm -rf / will delete all the OS, why admin even allow this comment?

Reply

13 Jose Tapia August 28, 2012 at 2:23 pm

Very useful info, thanks for share

Reply

14 yash November 7, 2012 at 4:19 pm

how can I print the virtual pages allocated to the currently running processes on my system and also the page faults associated with them?

Reply

15 srinivas February 6, 2013 at 11:41 am

Hi,

Most modern operating systems have their main memory divided into pages.

Please correct if i am wong ,
I think the main memory is divided into frames and the virtual memory is divided into pages.

Reply

16 Lucia October 7, 2014 at 12:42 pm

How do i implement a page size change in linux and what effect does it have if i either increase or decrease the page size?

Reply

Leave a Comment

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: