patch-2.1.99 linux/mm/vmscan.c
Next file: linux/net/Config.in
Previous file: linux/mm/page_alloc.c
Back to the patch index
Back to the overall index
- Lines: 83
- Date:
Tue Apr 28 14:19:02 1998
- Orig file:
v2.1.98/linux/mm/vmscan.c
- Orig date:
Thu Mar 26 15:57:06 1998
diff -u --recursive --new-file v2.1.98/linux/mm/vmscan.c linux/mm/vmscan.c
@@ -441,9 +441,6 @@
int i=6;
int stop;
- /* Let the dcache know we're looking for memory ... */
- shrink_dcache_memory();
-
/* Always trim SLAB caches when memory gets low. */
kmem_cache_reap(gfp_mask);
@@ -458,17 +455,17 @@
switch (state) {
do {
case 0:
+ state = 1;
if (shrink_mmap(i, gfp_mask))
return 1;
- state = 1;
case 1:
+ state = 2;
if ((gfp_mask & __GFP_IO) && shm_swap(i, gfp_mask))
return 1;
- state = 2;
default:
+ state = 0;
if (swap_out(i, gfp_mask))
return 1;
- state = 0;
i--;
} while ((i - stop) >= 0);
}
@@ -547,29 +544,26 @@
run_task_queue(&tq_disk);
schedule();
swapstats.wakeups++;
+
+ /* This will gently shrink the dcache.. */
+ shrink_dcache_memory();
/*
* Do the background pageout: be
* more aggressive if we're really
* low on free memory.
*
- * Normally this is called 4 times
- * a second if we need more memory,
- * so this has a normal rate of
- * X*4 pages of memory free'd per
- * second. That rate goes up when
- *
- * - we're really low on memory (we get woken
- * up a lot more)
- * - other processes fail to allocate memory,
- * at which time they try to do their own
- * freeing.
- *
- * A "tries" value of 50 means up to 200 pages
- * per second (1.6MB/s). This should be a /proc
- * thing.
+ * The number of tries is 512 divided by an
+ * 'urgency factor'. In practice this will mean
+ * a value of 512 / 8 = 64 pages at a time,
+ * giving 64 * 4 (times/sec) * 4k (pagesize) =
+ * 1 MB/s in lowest-priority background
+ * paging. This number rises to 8 MB/s when the
+ * priority is highest (but then we'll be woken
+ * up more often and the rate will be even higher).
+ * -- Should make this sysctl tunable...
*/
- tries = (50 << 2) >> free_memory_available(3);
+ tries = (512) >> free_memory_available(3);
while (tries--) {
int gfp_mask;
@@ -622,7 +616,7 @@
if ((long) (now - want) >= 0) {
if (want_wakeup || (num_physpages * buffer_mem.max_percent) < (buffermem >> PAGE_SHIFT) * 100
- || (num_physpages * page_cache.max_percent < page_cache_size)) {
+ || (num_physpages * page_cache.max_percent < page_cache_size * 100)) {
/* Set the next wake-up time */
next_swap_jiffies = now + swapout_interval;
wake_up(&kswapd_wait);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov