Only in linux-2.4.5/drivers/usb: ov511_decomp.c diff -ur -x ov511.* linux-2.4.5.orig/include/linux/swap.h linux-2.4.5/include/linux/swap.h --- linux-2.4.5.orig/include/linux/swap.h Sat May 26 02:01:27 2001 +++ linux-2.4.5/include/linux/swap.h Sat Jun 2 22:57:23 2001 @@ -172,9 +172,9 @@ * Since we do exponential decay of the page age, we * can chose a fairly large maximum. */ -#define PAGE_AGE_START 2 -#define PAGE_AGE_ADV 3 -#define PAGE_AGE_MAX 64 +#define PAGE_AGE_ADV 2 +#define PAGE_AGE_MAX 128 +#define PAGE_AGE_START 64 /* * List add/del helper macros. These must be called diff -ur -x ov511.* linux-2.4.5.orig/mm/mmap.c linux-2.4.5/mm/mmap.c --- linux-2.4.5.orig/mm/mmap.c Thu May 24 23:20:18 2001 +++ linux-2.4.5/mm/mmap.c Sat Jun 2 21:02:12 2001 @@ -56,8 +56,11 @@ unsigned long free; - /* Sometimes we want to use more memory than we have. */ - if (sysctl_overcommit_memory) + /* + * Sometimes we want to use more memory than we have. + * This includes for root, since he probably needs to log in. + */ + if (sysctl_overcommit_memory || current->uid == 0) return 1; free = atomic_read(&buffermem_pages); @@ -71,7 +74,7 @@ * for the swap-space over-allocation (ie "nr_swap_pages" being * too small. */ - free += swapper_space.nrpages; + /* free += swapper_space.nrpages; */ /* * The code below doesn't account for free space in the inode @@ -81,6 +84,14 @@ */ free += (dentry_stat.nr_unused * sizeof(struct dentry)) >> PAGE_SHIFT; free += (inodes_stat.nr_unused * sizeof(struct inode)) >> PAGE_SHIFT; + + /* + * We want to stop reservation before OOM. + */ + if(current->mm) + free -= (current->mm->total_vm / 4) + freepages.high; + else + free -= freepages.min; return free > pages; } diff -ur -x ov511.* linux-2.4.5.orig/mm/oom_kill.c linux-2.4.5/mm/oom_kill.c --- linux-2.4.5.orig/mm/oom_kill.c Tue May 15 08:25:41 2001 +++ linux-2.4.5/mm/oom_kill.c Sat Jun 2 20:47:45 2001 @@ -191,11 +191,19 @@ */ int out_of_memory(void) { + unsigned long free = 0; + /* Enough free memory? Not OOM. */ - if (nr_free_pages() > freepages.min) + if ((free = nr_free_pages()) > freepages.min) + return 0; + + free += nr_inactive_clean_pages(); + if(free > freepages.low) return 0; - if (nr_free_pages() + nr_inactive_clean_pages() > freepages.low) + free += atomic_read(&buffermem_pages); + free += atomic_read(&page_cache_size); + if(free > freepages.high) return 0; /* Enough swap space left? Not OOM. */ diff -ur -x ov511.* linux-2.4.5.orig/mm/swap.c linux-2.4.5/mm/swap.c --- linux-2.4.5.orig/mm/swap.c Mon Jan 22 21:30:21 2001 +++ linux-2.4.5/mm/swap.c Thu May 31 00:26:55 2001 @@ -105,13 +105,15 @@ */ void age_page_down_ageonly(struct page * page) { - page->age /= 2; + if(page->age) + page->age--; } void age_page_down_nolock(struct page * page) { /* The actual page aging bit */ - page->age /= 2; + if(page->age) + page->age--; /* * The page is now an old page. Move to the inactive @@ -139,7 +141,8 @@ void age_page_down(struct page * page) { /* The actual page aging bit */ - page->age /= 2; + if(page->age) + page->age--; /* * The page is now an old page. Move to the inactive diff -ur -x ov511.* linux-2.4.5.orig/mm/vmscan.c linux-2.4.5/mm/vmscan.c --- linux-2.4.5.orig/mm/vmscan.c Sat May 26 01:00:18 2001 +++ linux-2.4.5/mm/vmscan.c Sun Jun 3 01:48:21 2001 @@ -49,6 +49,14 @@ return; } + /* If it's been accesed frequently recently, age it down + * and leave it alone for the time being. + */ + if(page->age) { + page->age--; + return; + } + if (TryLockPage(page)) return; @@ -232,6 +240,13 @@ if (!count) return 1; + + /* Don't penalise processes which are already small + * compared to the one causing swapping out + */ + if(current->mm && mm->rss < current->mm->total_vm) + return 0; + /* * Go through process' page directory. */ @@ -467,6 +482,8 @@ page_ramdisk(page)) { del_page_from_inactive_dirty_list(page); add_page_to_active_list(page); + if(page->age < PAGE_AGE_START) + page->age = PAGE_AGE_START; continue; } @@ -655,24 +672,10 @@ /* * When we are background aging, we try to increase the page aging - * information in the system. When we have too many inactive pages - * we don't do background aging since having all pages on the - * inactive list decreases aging information. - * - * Since not all active pages have to be on the active list, we round - * nr_active_pages up to num_physpages/2, if needed. + * information in the system. */ - if (!target) { - int inactive = nr_free_pages() + nr_inactive_clean_pages() + - nr_inactive_dirty_pages; - int active = MAX(nr_active_pages, num_physpages / 2); - if (active > 10 * inactive) - maxscan = nr_active_pages >> 4; - else if (active > 3 * inactive) - maxscan = nr_active_pages >> 8; - else - return 0; - } + if(!target) + maxscan = nr_active_pages >> 4; /* Take the lock while messing with the list... */ spin_lock(&pagemap_lru_lock);