home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!torvalds
- From: torvalds@klaava.Helsinki.FI (Linus Torvalds)
- Newsgroups: comp.os.linux
- Subject: Re: VM wizards - verify this please
- Message-ID: <1992Nov19.183029.9447@klaava.Helsinki.FI>
- Date: 19 Nov 92 18:30:29 GMT
- References: <5623@krafla.rhi.hi.is> <1992Nov19.181645.7977@klaava.Helsinki.FI>
- Organization: University of Helsinki
- Lines: 39
-
- Arghh. I really should read the questions a bit more carefully.. My
- answer to nr 3 wasn't actually an answer to the question.
-
- In article <1992Nov19.181645.7977@klaava.Helsinki.FI> torvalds@klaava.Helsinki.FI (Linus Torvalds) writes:
- >In article <5623@krafla.rhi.hi.is> sigurasg@rhi.hi.is (Sigurdur Asgeirsson) writes:
- >>
- >>3. When swapping out:
- >> All pagetables are searched for in-core pages and those are swapped
- >> out by saving them to disk, decrementing the share count and freeing
- >> if share count == 0.
- >> This result in multiple copies of shared pages in swap, and, on next
- >> reference, in memory, does it not? (and why all the ','?)
-
- Actually, it doesn't result in multiple copies of the same page being
- swapped out: shared pages are *not* swapped out at all.
-
- The algorithm for swapping out a page is:
-
- (a) is the page clean?
-
- yes - just forget it and decrement the page counter. We know we
- can always re-demand-load it (or share it, or just fill it with
- zero's or whatever)
-
- (b) is the page dirty?
-
- if it's used by more than 1 process we don't swap it out at all:
- it's too complicated to try to find all the copies of the page
- etc..
-
- if mem_map[] for the page is 1, we swap it out and free the
- page.
-
- So the result of the above is that shared pages are never written out to
- swapspace, although they can be forgotten about (safely) if they are
- clean. Most shared pages are clean anyway (shared pages can be dirty
- only after a fork()).
-
- Linus
-