From: Jesse Pollard <pollard@tomcat.admin.navo.hpc.mil>
To: jas88@cam.ac.uk, Remco Post <r.post@sara.nl>,
linux-kernel@vger.kernel.org
Subject: Re: Swap
Date: Mon, 19 Nov 2001 10:36:03 -0600 (CST) [thread overview]
Message-ID: <200111191636.KAA17722@tomcat.admin.navo.hpc.mil> (raw)
In-Reply-To: <E165oY1-0006Db-00@mauve.csi.cam.ac.uk>
James A Sutherland <jas88@cam.ac.uk>:
> On Monday 19 November 2001 10:51 am, Remco Post wrote:
> > --8<--
> >
> > > Except that openoffice and mozilla can be swapped out in BOTH cases: the
> > > kernel can discard mapped pages and reread as needed, whether you have a
> > > swap partition or not.
> >
> > No they can't without swap, nothing can be SWAPPED out. The code pages can
> > be paged out (discarded), but no SWAPPING takes place.
>
> OK, s/swapped/paged/.
>
> > > Whereas without swapspace, only the read-only mapped pages can be swapped
> > > out.
> >
> > Again, pages do not gat swapped out, only applications can get swapped out.
> > Swapping is per definition the process of removing all pages used by one
> > application from RAM, and moving ALL pages to swap.
>
> So in effect, Linux never ever swaps. At all. Under any circumstances. (Using
> your interpretation of the word). Which does raise the question of WTF that
> "swap space" is for, and why it's really used for "paging"...
Linux doesn't - but some UNIX systems do swap. This is when the kernel pages
out the process header, page tables, process kernel stack ...
At this point the process is in the equivalent state as that of the system
that only does "swapping".
The swap space is used when more physical memory is required than is available
for user data. The modified pages of user data are written to the swap space
and the physical page re-used for another purpose. Effectively "swapping" the
use of the page... :-)
> > > Provided the VM is doing its job properly, adding swap will always be a
> > > net win for efficiency: the kernel is able to dump unused pages to make
> > > more room for others. Of course, you tend to "feel" the response times to
> > > interactive events, rather than the overall throughput, so a change which
> > > slows the system down but makes it more "responsive" to mouse clicks etc
> > > feels like a net win...
> >
> > With any properly sized system, it will NEVER SWAP. Paging is a completely
> > different thing. A little paging is not a problem. Up to 70 pagescans/s on
> > occasion is quite acceptable. If paging activety grows above that, you may
> > have a real problem. I don't know about the current VM, but with most
> > unixes when you hit this mark, the system actually starts swapping, and
> > your responsiveness goes down the drain....
>
> By your definition, Linux does not swap, ever. It only "pages". This is what
> I was referring to as swapping, since this involves the SWAPspace/partition,
> rather than PAGEfile :)
The problem is determining "properly sized system". Second - ALL linux systems
will page in (or swap in) executables, if only at the start of executution
(easiest/fasted way to load the program... mmap is quick, even if it does
blur the distinction between process pages and I/O cache)
Linux uses RAM+SWAP for virtual memory operation, and swaps pages used for
data to the "swap space" to use different "swapped pages" to load back into
physical memory. Since this is effectively hidden from most activity (and
measures), it becomes easy to oversubscribe memory, causing thrashing (lots
of page activity for little gain), where a system with mixed paging + swapping
(page out entire processes and disable scheduling them) CAN make significant
progress.
The other use of RAM is for data caching. Usually is faster to keep file data
loaded into RAM for use by programs. Runtime libraries are frequently where
the majority of CPU time is spent - Instead of waiting for data to be
transferred to RAM for use, Linux tries to "read ahead" accomplishing more
throughput that way by not forcing the active process to wait for the data.
The tricky part is determining the balance between the data cache, and process
memory.
The systems that use a combined pageing + swapping use a variety of measures
to decide what should be paged or swapped. Some characteristics used by these
systems are:
1. number of page faults/sec (swap if > watermark - reduces thrashing)
2. time elapsed since last completed I/O (if greater than some watermark, swap
- makes more RAM available)
3. idle processes (wait time > watermark, swap - discard executable pages,
swap out data pages)
4. batch processes (operate at a lower priority - swap non-interactive
processes - makes more RAM available)
5. High memory requirements (reduce resident set size; which invokes item 1)
6. Users priority (swap lower priority processes - make more RAM available)
Of course the sys admin must have control over all of the watermarks and/or
resource allocations. These are more characteristics of a general computation
or batch system than they are of a single user workstation, which is where
Linux started.
Hope I've help clear up some things.
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@navo.hpc.mil
Any opinions expressed are solely my own.
next prev parent reply other threads:[~2001-11-19 16:36 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.inl6g6v.1mmbp4@ifi.uio.no>
[not found] ` <fa.heevhav.sjs8an@ifi.uio.no>
2001-11-18 22:15 ` Swap Dan Maas
2001-11-18 22:43 ` Swap François Cami
2001-11-19 9:18 ` Swap James A Sutherland
2001-11-19 10:51 ` Swap Remco Post
2001-11-19 13:33 ` Swap James A Sutherland
2001-11-19 13:46 ` Swap Remco Post
2001-11-19 16:58 ` Swap Rik van Riel
[not found] ` <Pine.LNX.4.33L.0111191458150.1491-100000@duckman.distro.conecti va>
2001-11-19 21:13 ` Swap Alex Bligh - linux-kernel
2001-11-19 21:17 ` Swap Rik van Riel
[not found] ` <Pine.LNX.4.33L.0111191917000.1491-100000@duckman.distro.conecti va>
2001-11-19 21:52 ` Swap Alex Bligh - linux-kernel
2001-11-19 16:36 ` Jesse Pollard [this message]
2001-11-20 14:51 ` Swap J.A. Magallon
2001-11-20 16:01 ` Swap Wolfgang Rohdewald
2001-11-20 16:06 ` Swap Remco Post
2001-11-20 16:12 ` Swap Nick LeRoy
2001-11-20 16:20 ` Swap Richard B. Johnson
2001-11-20 17:14 ` Swap Christopher Friesen
2001-11-20 17:40 ` Swap Richard B. Johnson
2001-11-20 18:14 ` Swap Nick LeRoy
2001-11-21 10:17 ` Swap Helge Hafting
2001-11-21 11:17 ` Swap Alan Cox
2001-11-20 23:20 ` Swap Luigi Genoni
2001-11-21 16:44 ` Swap Remco Post
2001-11-20 17:58 ` Swap Wolfgang Rohdewald
2001-11-26 21:51 ` [Linux-abi-devel] Swap Christoph Hellwig
2001-11-20 21:05 ` Swap Steffen Persvold
2001-11-20 21:18 ` Swap Mike Fedyk
2001-11-20 21:33 ` Swap Nick LeRoy
2001-11-20 21:44 ` Swap Mike Fedyk
2001-11-20 22:00 ` Swap Nick LeRoy
2001-11-21 16:53 ` Swap Remco Post
2001-11-20 21:43 ` Swap Richard B. Johnson
2001-11-20 21:50 ` NFS, Paging & Installing [was: Re: Swap] Mike Fedyk
2001-11-21 1:22 ` Horst von Brand
2001-11-21 1:46 ` Mike Fedyk
2001-11-21 10:55 ` Trond Myklebust
2001-11-22 5:16 ` Bernd Eckenfels
2001-11-22 12:19 ` Trond Myklebust
2001-11-23 19:33 ` Mike Fedyk
2001-11-20 21:19 ` Swap Nick LeRoy
2001-11-21 16:48 ` Swap Remco Post
2001-11-20 20:58 ` Swap Mike Fedyk
2001-11-19 10:03 ` Swap Tim Connors
2001-11-19 10:16 ` Swap Dan Maas
[not found] <fa.kb6ct7v.pgku0d@ifi.uio.no>
[not found] ` <fa.k8qdvcv.184ak2l@ifi.uio.no>
2001-11-20 22:46 ` Swap Dan Maas
2001-11-20 23:17 ` Swap Trond Myklebust
[not found] <fa.kmf405v.j74f21@ifi.uio.no>
[not found] ` <fa.ns5ugpv.q02sbg@ifi.uio.no>
2001-11-20 21:26 ` Swap Dan Maas
2001-11-20 22:05 ` Swap Rik van Riel
2001-11-20 22:11 ` Swap David S. Miller
2001-11-20 22:19 ` Swap Rik van Riel
2001-11-20 22:34 ` Swap Dan Maas
2001-11-20 23:05 ` Swap Andrew Morton
[not found] ` <fa.jc73ejv.1s6e80t@ifi.uio.no>
2001-11-21 1:45 ` Swap Håvard Kvålen
2001-11-21 4:23 ` Swap Andreas Dilger
2001-11-20 22:23 ` Swap Andrew Morton
2001-11-20 23:01 ` Swap David S. Miller
2001-11-20 23:35 ` Swap Rik van Riel
2001-11-20 23:40 ` Swap David S. Miller
2001-11-21 0:19 ` Swap Rik van Riel
2001-11-21 0:21 ` Swap David S. Miller
2001-11-18 21:12 Swap war
2001-11-18 21:25 ` Swap James A Sutherland
2001-11-18 21:28 ` Swap war
2001-11-18 21:42 ` Swap François Cami
2001-11-18 21:45 ` Swap war
2001-11-18 23:03 ` Swap Erik Gustavsson
2001-11-19 18:12 ` Swap Eric W. Biederman
2001-11-19 18:43 ` Swap Rik van Riel
2001-11-20 2:49 ` Swap Eric W. Biederman
2001-11-20 3:33 ` Swap Ryan Cumming
2001-11-20 11:43 ` Swap Rik van Riel
2001-11-20 11:41 ` Swap Rik van Riel
2001-11-19 19:12 ` Swap James A Sutherland
2001-11-20 2:47 ` Swap Eric W. Biederman
2001-11-20 9:16 ` Swap James A Sutherland
2001-11-18 22:05 ` Swap J.A. Magallon
2001-11-18 22:21 ` Swap François Cami
2001-11-18 22:36 ` Swap Charles Marslett
2001-11-18 22:54 ` Swap J.A. Magallon
2001-11-18 23:36 ` Swap Bernd Eckenfels
-- strict thread matches above, loose matches on Subject: below --
2001-10-18 5:06 RFC - tree quotas for Linux (2.4.12, ext2) Neil Brown
2001-10-18 5:53 ` Ben Greear
2001-10-18 8:38 ` James Sutherland
2001-10-18 20:20 ` Mike Fedyk
2001-10-18 20:47 ` Tim Walberg
2001-10-19 1:07 ` Neil Brown
2001-10-19 3:03 ` Rik van Riel
2001-10-19 11:50 ` Horst von Brand
2001-10-19 17:00 ` Mike Fedyk
2001-10-18 21:17 ` Andreas Dilger
2001-10-18 22:56 ` Mike Fedyk
2001-10-19 0:14 ` Horst von Brand
2001-10-19 0:51 ` Mike Fedyk
2001-10-19 1:13 ` Neil Brown
2001-10-19 0:53 ` Neil Brown
2001-10-24 15:16 ` Jan Kara
2001-10-24 15:34 ` James Sutherland
2001-10-24 15:39 ` Jan Kara
2001-10-24 15:50 ` James Sutherland
2001-10-24 17:41 ` Rik van Riel
2001-10-24 18:08 ` James Sutherland
2001-10-26 11:25 ` Pavel Machek
2001-10-24 21:24 ` Neil Brown
2001-10-25 15:48 ` Jan Kara
2001-10-26 4:36 ` Neil Brown
2001-10-29 14:06 ` Jan Kara
2001-10-29 23:23 ` Neil Brown
2001-10-30 12:33 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200111191636.KAA17722@tomcat.admin.navo.hpc.mil \
--to=pollard@tomcat.admin.navo.hpc.mil \
--cc=jas88@cam.ac.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=r.post@sara.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome