Q: Info about paging (count of page-in/page-out)?

Q: Info about paging (count of page-in/page-out)?

Post by Sheetal V. Kakk » Wed, 22 Oct 1997 04:00:00



Is there a way to get exact information on the number of pages swapped
out and/or swapped in (as part of paging behavior caused by the
application) at any given point in an application?

I have program that does repeated traversals over a
tree/directed-graph like structure, starting with a different root
every time (although there is probably some overlap in the nodes
visited). The data structure is larger than main memory size, and so
there is obviously paging as previously-unreferenced pages are swapped
in and others are swapped out to make room for the newly-loaded pages.
What I would like to do is measure the number of page-outs and
page-ins for each iteration of my traversal so that I have a measure
of the paging activity that goes on for that iteration. Is there
something I can get from the /proc filesystem or from the page daemons
or elsewhere? (I don't necessarily care about whether the pages
paged-out belong to this application or not, just that they were
necessary due to the allocationbehavior of this application.)

I know about major page faults from getrusage, but I am not sure if
that number is precise, and also whether it includes both page-outs
and page-ins. For example, if I fault on a page that is swapped in,
and say that another page had to be swapped out to make room for the
new page, does that count as one or two major page faults?

Also, where can I find more information about the page-out mechanisms
of Linux? I would guess that page-outs (writes) are cheaper than
page-ins (reads) because they can be grouped together (page-out
several pages at a time), and may take advantage of some write
buffering (on disk?) Any information, details, etc. about paging
mechanisms will be very much appreciated.

Thanks in advance,

Sheetal
--
----------------------------------------------------------------------
Sheetal V. Kakkad           Department of Computer Sciences, UT-Austin

 
 
 

Q: Info about paging (count of page-in/page-out)?

Post by Mats Andtback » Thu, 23 Oct 1997 04:00:00



Quote:>Is there a way to get exact information on the number of pages swapped
>out and/or swapped in (as part of paging behavior caused by the
>application) at any given point in an application?

"ps m" seems to do it. note that pages fetched from the buffer cache
apparently count as hard page faults, though. vmstat fetches similar
data from somewhere, too. the procps suite of programs all (well,
nearly all) get their information from /proc through a library,
libproc.so i think it was; you might want to look into its API. the
best reference would likely be the procps sources.

[...]

Quote:>I know about major page faults from getrusage, but I am not sure if
>that number is precise, and also whether it includes both page-outs
>and page-ins. For example, if I fault on a page that is swapped in,
>and say that another page had to be swapped out to make room for the
>new page, does that count as one or two major page faults?

unless i've badly misunderstood things (anybody who knows, feel free
to correct me if i have) page-outs do not count as page faults at all.
a page-in would be a major page fault, certainly, and as noted i think
even a "page-in" from the buffer cache might be one, but i'm unclear
on what minor ("soft") page faults are.

one would think the procps man pages would clarify this, but they
don't. the ps(1) manpage doesn't even document all the columns in the
"ps m" output, and at least one (LIBS) i think is defunct since moving
to ELF. i'm tempted to learn *roff so i could help rewrite these man
pages, but i don't know what to put in, since i don't understand these
things fully myself.

Quote:>Also, where can I find more information about the page-out mechanisms
>of Linux?

likely only the kernel sources, because the VM system has changed
markedly even just between 2.0.x and recent 2.1.x kernels. possibly
the new system is in 2.0.31 too, i haven't looked at that patch. if
there is any good documentation outside the kernel source tree i'd
like to know of it myself.

Quote:>I would guess that page-outs (writes) are cheaper than page-ins
>(reads) because they can be grouped together (page-out several pages
>at a time), and may take advantage of some write buffering (on disk?)

any I/O (AFAIK, anyway) benefits from the elevator seek technique.
IIRC writes are not given any advantage over reads, but i may be
wrong.
--
        "Yes i'm lonely..."
                _Yer Blues_, Lennon / McCartney

 
 
 

1. More page outs than page ins?

Hi,

Would anyone be kind enough to explain to me why systems usually have
more page-outs than page-ins? It has got me stumped for quite some
time. I would think that if 100mb is paged out from memory to disk,
then similarly 100mb should be paged-in back from disk to physical
memory?

Or is my understand of paging-in and paging-out wrong? i.e Page-outs
occur when a page is pushed from main memory to the paging space due
to a variety of reasons (lack of physical memory being one of them)
while page-ins' occur when there is free physical memory and these
pages are pushed back from disk back to the physical memory.

TIA!

2. colorado tape backup?

3. Fix: Init page count for all pages during higher order allocs

4. Compile htdig

5. KWord: page 1 in footer shows page 1 on all pages

6. Help with script for logon tim

7. what is causing system to do page-in/page-out?

8. Help on programming a ping client program

9. how change a page size for man' output and how insert FF after every pages

10. Page Up Page Down issues

11. large page patch (fwd) (fwd) ==>hugetlb page patch

12. separate page base and file page offset in NFS client

13. Enabling Page-Up, Page-Down, Copy, Paste keys