Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Understanding How AIX Manages Memory / Page Space.

AIX Memory Management

Understanding How AIX Manages Memory / Page Space.

by  vickersdc  Posted    (Edited  )

Data is essentially held in pages of 4096b, and a page in RAM is accessible by the CPU, if the page is on disk the CPU can't access it directly.

A page fault occurs when a wanted page address does not translate to a real memory address. At this point the Virtual Memory Manager (VMM)knows it needs to get data from disk and place it in RAM - it therefore checks to see that there is space in RAM in which to out this data.

If there's enough room, VMM checks to see if the wanted page has been used previously by this process:

- if not, an "initial page fault", VMM allocates _two_ pages for the data; one in RAM and the other on a backing page on disk where it can go if it has to be temporarily removed from RAM. This is known as "late page space allocation".

- if it has, a "repage fault" I/O is scheduled to bring the data back from disk and into RAM - the act of resolving this repage fault is called a "page-in" (the process that is waiting for this to happen is in a "page wait state").

So what happens if there's not enough room in RAM to put the page? Well the page stealer is there to ensure that there is a supply of free RAM pages available for an initial page fault. If the number of free RAM pages drops below a specified value then the page stealer will try and get some pages back. It keeps on stealing pages until it reaches an upper limit.

So how does it decide which pages to steal? The page stealer will select the least recently used, or LRU, pages. If the page has been modified in RAM it's classed as a dirty page and is put to a backing store (either page space or a filesystem); if it's clean (the copy in RAM matches the copy in page space) then the RAM page is purged.

Note that the page space is used for non-persistent or working pages, and the filesystem is used for persistent or file pages.

There is, of course, a basic assumption here that all stale pages are treated equally, i.e. whether it's a file- or nonfile- page makes no difference to the page stealer.

However this is not the case. Increased paging activity makes VMM act upon the different types of (stale) pages in a different manner. When the number of [stale] file pages exceed a number - set by the maxperm threshold - the page stealer will steal only file pages.

If the number of stale file pages is below maxperm (but above the set minperm threshold) then two other considerations come into play.

The VMM checks the repage rates of both file and nonfile pages, and will steal file pages if the file page repage rate is higher than the repage rate for nonfiles.

If this not the case then both types of pages are treated as equal victims.

PERFORMANCE HITS / ACTUAL DISK I/O...

To understand the performance hit of the paging figures that you come across, you need to realise that page faults do NOT (necessarily) result in disk activity. Remember from above that only the repage fault - the act of bringing back previously used data into memory - causes disk I/O to be scheduled.

Page out I/O only occurs when a page is stolen by the page stealer AND is marked as 'dirty'. This only happens when there is a shortage of free RAM pages. Hence the page-out figure can be an indicator of how memory constrained the system is. The vmstat command is only of limited use as it just reports activity concerned with page space (and not paging to/from filesystem space).

If the system consistently appears to hover around the minperm value (the "fre" column in vmstat) then it does not follow that the system is memory constrained - consider the scenario where an initial page fault is resolved by purging a clean, but stale, page. In this there is paging activity but no corresponding I/O.

System performance may be improved by reducing the amount of RAM that file pages occupy - this ensures that working pages are not continually being pushed out to make way for file pages.

This can be achieved through the use of the vmtune command (/usr/samples/kernel) and DECREASING values for minperm and maxperm.

PAGING SPACE

So how much page space do I need? For systems that have up to 256MB of real memory, use the well known formula...

page_space = 2 x real_memory

...for those systems with more than 256MB of real memory use...

page_space = 512MB + (real_memory - 256MB) * 1.25

The following should also be adhered to where possible:

1. configure just one paging space per disk
2. use between 2 and 6 paging spaces in a medium size system
3. configure the paging spaces on each disk to be the same size

That's about it really - all you never needed to know about paging space and VMM.

Dave V.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top