diff -urNp ref/include/linux/swap.h 2.4.20pre7aa1/include/linux/swap.h --- ref/include/linux/swap.h Fri Sep 13 06:13:57 2002 +++ 2.4.20pre7aa1/include/linux/swap.h Wed Sep 18 00:18:16 2002 @@ -116,6 +116,7 @@ extern void swap_setup(void); extern wait_queue_head_t kswapd_wait; extern int FASTCALL(try_to_free_pages_zone(zone_t *, unsigned int)); extern int FASTCALL(try_to_free_pages(unsigned int)); +extern int vm_vfs_scan_ratio, vm_cache_scan_ratio, vm_lru_balance_ratio, vm_passes, vm_gfp_debug, vm_mapped_ratio; /* linux/mm/page_io.c */ extern void rw_swap_page(int, struct page *); diff -urNp ref/include/linux/sysctl.h 2.4.20pre7aa1/include/linux/sysctl.h --- ref/include/linux/sysctl.h Wed Sep 18 00:17:50 2002 +++ 2.4.20pre7aa1/include/linux/sysctl.h Wed Sep 18 00:17:51 2002 @@ -143,7 +143,12 @@ enum VM_MAX_MAP_COUNT=11, /* int: Maximum number of active map areas */ VM_MIN_READAHEAD=12, /* Min file readahead */ VM_MAX_READAHEAD=13, /* Max file readahead */ - VM_HEAP_STACK_GAP=14, /* int: page gap between heap and stack */ + VM_VFS_SCAN_RATIO=14, /* part of the inactive vfs lists to scan */ + VM_LRU_BALANCE_RATIO=15,/* balance active and inactive caches */ + VM_PASSES=16, /* number of vm passes before failing */ + VM_GFP_DEBUG=17, /* debug GFP failures */ + VM_CACHE_SCAN_RATIO=18, /* part of the inactive cache list to scan */ + VM_MAPPED_RATIO=19, /* amount of unfreeable pages that triggers swapout */ }; diff -urNp ref/kernel/sysctl.c 2.4.20pre7aa1/kernel/sysctl.c --- ref/kernel/sysctl.c Wed Sep 18 00:17:50 2002 +++ 2.4.20pre7aa1/kernel/sysctl.c Wed Sep 18 00:17:51 2002 @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -260,6 +261,18 @@ static ctl_table kern_table[] = { }; static ctl_table vm_table[] = { + {VM_GFP_DEBUG, "vm_gfp_debug", + &vm_gfp_debug, sizeof(int), 0644, NULL, &proc_dointvec}, + {VM_VFS_SCAN_RATIO, "vm_vfs_scan_ratio", + &vm_vfs_scan_ratio, sizeof(int), 0644, NULL, &proc_dointvec}, + {VM_CACHE_SCAN_RATIO, "vm_cache_scan_ratio", + &vm_cache_scan_ratio, sizeof(int), 0644, NULL, &proc_dointvec}, + {VM_MAPPED_RATIO, "vm_mapped_ratio", + &vm_mapped_ratio, sizeof(int), 0644, NULL, &proc_dointvec}, + {VM_LRU_BALANCE_RATIO, "vm_lru_balance_ratio", + &vm_lru_balance_ratio, sizeof(int), 0644, NULL, &proc_dointvec}, + {VM_PASSES, "vm_passes", + &vm_passes, sizeof(int), 0644, NULL, &proc_dointvec}, {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &bdflush_min, &bdflush_max}, diff -urNp ref/mm/page_alloc.c 2.4.20pre7aa1/mm/page_alloc.c --- ref/mm/page_alloc.c Wed Sep 18 00:17:46 2002 +++ 2.4.20pre7aa1/mm/page_alloc.c Wed Sep 18 00:17:51 2002 @@ -44,6 +44,8 @@ static int zone_balance_ratio[MAX_NR_ZON static int zone_balance_min[MAX_NR_ZONES] __initdata = { 20 , 20, 20, }; static int zone_balance_max[MAX_NR_ZONES] __initdata = { 255 , 255, 255, }; +int vm_gfp_debug = 0; + /* * Temporary debugging check. */ diff -urNp ref/mm/vmscan.c 2.4.20pre7aa1/mm/vmscan.c --- ref/mm/vmscan.c Fri Sep 13 06:13:57 2002 +++ 2.4.20pre7aa1/mm/vmscan.c Wed Sep 18 00:19:55 2002 @@ -27,12 +27,42 @@ #include /* - * The "priority" of VM scanning is how much of the queues we - * will scan in one go. A value of 6 for DEF_PRIORITY implies - * that we'll scan 1/64th of the queues ("queue_length >> 6") - * during a normal aging round. + * "vm_passes" is the number of vm passes before failing the + * memory balancing. Take into account 3 passes are needed + * for a flush/wait/free cycle and that we only scan 1/vm_cache_scan_ratio + * of the inactive list at each pass. */ -#define DEF_PRIORITY (6) +int vm_passes = 60; + +/* + * "vm_cache_scan_ratio" is how much of the inactive LRU queue we will scan + * in one go. A value of 6 for vm_cache_scan_ratio implies that we'll + * scan 1/6 of the inactive lists during a normal aging round. + */ +int vm_cache_scan_ratio = 6; + +/* + * "vm_mapped_ratio" controls the pageout rate, the smaller, the earlier + * we'll start to pageout. + */ +int vm_mapped_ratio = 100; + +/* + * "vm_lru_balance_ratio" controls the balance between active and + * inactive cache. The bigger vm_balance is, the easier the + * active cache will grow, because we'll rotate the active list + * slowly. A value of 2 means we'll go towards a balance of + * 1/3 of the cache being inactive. + */ +int vm_lru_balance_ratio = 2; + +/* + * "vm_vfs_scan_ratio" is what proportion of the VFS queues we will scan + * in one go. A value of 6 for vm_vfs_scan_ratio implies that 1/6th of + * the unused-inode, dentry and dquot caches will be freed during a normal + * aging round. + */ +int vm_vfs_scan_ratio = 6; /* * The swap-out function returns 1 if it successfully @@ -578,7 +608,7 @@ static int shrink_caches(zone_t * classz shrink_dcache_memory(priority, gfp_mask); shrink_icache_memory(priority, gfp_mask); #ifdef CONFIG_QUOTA - shrink_dqcache_memory(DEF_PRIORITY, gfp_mask); + shrink_dqcache_memory(priority, gfp_mask); #endif return nr_pages; @@ -586,7 +616,7 @@ static int shrink_caches(zone_t * classz int try_to_free_pages_zone(zone_t *classzone, unsigned int gfp_mask) { - int priority = DEF_PRIORITY; + int priority = 6; int nr_pages = SWAP_CLUSTER_MAX; gfp_mask = pf_gfp_mask(gfp_mask);