On Tue, Jun 05, 2007 at 03:44:02PM +0200, Devvrat Tripathi wrote:
> I dont exactly get the syscall swapon thing properly. Swap is supposed to be
> activated by the kernel right incase the main memory gets filled up. I dont
> understand how the kernel uses this system call as you cannot do system
> calls from kernel space or is there some daemon which is responsible to do
> this job.
"Activating swap" usually means enabling swap by pointing the kernel to
a swap partition or file to swap on, and that's what the swapon(2)
system call is used for. What you probably mean is called "swapping
out".
Figuring out which pages can be swapped out is quite a hairy subject
and whatever algorithm you come up with, there will always be a corner
case where it will fail. Here are some URLs to get you started:
- - Understanding the Linux Virtual Memory Manager:
http://www.csn.ul.ie/~mel/projects/vm/guide/html/understand/
- - The Linux MM home page:
http://linux-mm.org/