Index: linux-2.6.7-ck/include/linux/swap.h =================================================================== --- linux-2.6.7-ck.orig/include/linux/swap.h 2004-07-09 00:58:31.361672196 +1000 +++ linux-2.6.7-ck/include/linux/swap.h 2004-07-09 00:59:38.291824625 +1000 @@ -174,7 +174,6 @@ /* linux/mm/vmscan.c */ extern int try_to_free_pages(struct zone **, unsigned int, unsigned int); extern int shrink_all_memory(int); -extern int vm_swappiness; #ifdef CONFIG_MMU /* linux/mm/shmem.c */ Index: linux-2.6.7-ck/include/linux/sysctl.h =================================================================== --- linux-2.6.7-ck.orig/include/linux/sysctl.h 2004-07-09 00:58:31.360672359 +1000 +++ linux-2.6.7-ck/include/linux/sysctl.h 2004-07-09 01:00:17.860423950 +1000 @@ -159,13 +159,12 @@ VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */ VM_PAGEBUF=17, /* struct: Control pagebuf parameters */ VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */ - VM_SWAPPINESS=19, /* Tendency to steal mapped memory */ - VM_LOWER_ZONE_PROTECTION=20,/* Amount of protection of lower zones */ - VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */ - VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */ - VM_LAPTOP_MODE=23, /* vm laptop mode */ - VM_BLOCK_DUMP=24, /* block dump mode */ - VM_HUGETLB_GROUP=25, /* permitted hugetlb group */ + VM_LOWER_ZONE_PROTECTION=19,/* Amount of protection of lower zones */ + VM_MIN_FREE_KBYTES=20, /* Minimum free kilobytes to maintain */ + VM_MAX_MAP_COUNT=21, /* int: Maximum number of mmaps/address-space */ + VM_LAPTOP_MODE=22, /* vm laptop mode */ + VM_BLOCK_DUMP=23, /* block dump mode */ + VM_HUGETLB_GROUP=24, /* permitted hugetlb group */ }; Index: linux-2.6.7-ck/kernel/sysctl.c =================================================================== --- linux-2.6.7-ck.orig/kernel/sysctl.c 2004-07-09 00:58:31.337676091 +1000 +++ linux-2.6.7-ck/kernel/sysctl.c 2004-07-09 00:59:38.293824302 +1000 @@ -732,17 +732,6 @@ .mode = 0444 /* read-only*/, .proc_handler = &proc_dointvec, }, - { - .ctl_name = VM_SWAPPINESS, - .procname = "swappiness", - .data = &vm_swappiness, - .maxlen = sizeof(vm_swappiness), - .mode = 0644, - .proc_handler = &proc_dointvec_minmax, - .strategy = &sysctl_intvec, - .extra1 = &zero, - .extra2 = &one_hundred, - }, #ifdef CONFIG_HUGETLB_PAGE { .ctl_name = VM_HUGETLB_PAGES, Index: linux-2.6.7-ck/mm/vmscan.c =================================================================== --- linux-2.6.7-ck.orig/mm/vmscan.c 2004-07-09 00:58:31.336676253 +1000 +++ linux-2.6.7-ck/mm/vmscan.c 2004-07-09 00:59:38.294824140 +1000 @@ -40,9 +40,9 @@ #include /* - * From 0 .. 100. Higher means more swappy. + * From 0 .. 150. Higher means more swappy. */ -int vm_swappiness = 60; +static int vm_swappiness; static long total_memory; #define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru)) @@ -689,17 +689,18 @@ * is mapped. */ mapped_ratio = (sc->nr_mapped * 100) / total_memory; - + /* * Now decide how much we really want to unmap some pages. The mapped - * ratio is downgraded - just because there's a lot of mapped memory + * ratio effect is downgraded by biasing downwards the value of + * vm_swappiness - just because there's a lot of mapped memory * doesn't necessarily mean that page reclaim isn't succeeding. * * The distress ratio is important - we don't want to start going oom. - * - * A 100% value of vm_swappiness overrides this algorithm altogether. */ - swap_tendency = mapped_ratio / 2 + distress + vm_swappiness; + vm_swappiness = mapped_ratio * 150 / 100; + vm_swappiness = vm_swappiness * vm_swappiness / 150; + swap_tendency = distress + vm_swappiness; /* * Now use this metric to decide whether to start moving mapped memory