the objection of this patch is to improve the behaviour of the kernel when reaching a all physical memory used situation. removed swapfull() checks from fault.c and segment.c as the pagers oom handler will deal with the situation. the killbig way of recovering is more deterministic as the user can prevent it from killing say the local fileserver or the window system by changing the permissions in /proc/n. with swapfull, any process that runs will randomly fail and if its your local fileserver, the machine is dead. also, the system will now behave the same with or without swap file enabled. changed pio() in port/fault.c: only access the s->image while we hold s->lk simplified code so demand load and swap in becomes the same code path added ulong gen field to struct Page in port/portfns.h. pager uses a generation counter (genclock) that it increases after each walk through the process table. pages that got referenced/ accessed get the current genclock value assigned. the pager can now determine the age of a page by calculating the difference between the genclock and page->gen. on each genclock increment, all unreferenced pages get older by one generation. on each walk, the pager calculates the average age of pages wich is used in the next generation to decide if a page should be swapped or left alone. if a page is younger or equal the average age of the pages from the last generation walk, it is not swapped out. sort the io transaction list of the pager before processing. when the pager detects a swapfull, it will invoke the oom path and call killbig().