[PATCH] pager_daemon.tries_min

Project BRAVO (bravo@russell.ce.uniroma2.it)
Tue, 13 Oct 1998 15:18:57 +0200


Here there is a small patch to kswapd() which enables the use of
pager_daemon.tries_min. It also makes some corrections to a comment.

I'm not really sure that this could be regarded as `bug fix',
however. The behaviour of the swapping algorithm is not changed by
the patch, unless you play with /proc/sys/vm/kswapd and
modify tries_min.

Marco Cesati

+---------------------------------------------------------------+
| Computer Engineering - Project BRAVO |
+---------------------------------------------------------------+
| University of Rome "Tor Vergata" |
| Dept. of Computer Science, Systems and Industrial Engineering |
| via di Tor Vergata, 00133 Rome (Italy) |
| e-mail: bravo@russell.ce.uniroma2.it |
+---------------------------------------------------------------+

diff -ruN linux-2.1.125/mm/swap.c linux/mm/swap.c
--- linux-2.1.125/mm/swap.c Thu Sep 17 12:25:56 1998
+++ linux/mm/swap.c Tue Oct 13 13:53:32 1998
@@ -82,6 +82,6 @@

pager_daemon_t pager_daemon = {
512, /* base number for calculating the number of tries */
- SWAP_CLUSTER_MAX, /* minimum number of tries */
+ 2, /* minimum number of tries */
SWAP_CLUSTER_MAX, /* do swap I/O in clusters of this size */
};
diff -ruN linux-2.1.125/mm/vmscan.c linux/mm/vmscan.c
--- linux-2.1.125/mm/vmscan.c Fri Oct 9 13:04:03 1998
+++ linux/mm/vmscan.c Tue Oct 13 14:20:52 1998
@@ -562,10 +562,10 @@
*
* We try page_daemon.tries_base times, divided by
* an 'urgency factor'. In practice this will mean
- * a value of pager_daemon.tries_base / 8 or 4 = 64
- * or 128 pages at a time.
- * This gives us 64 (or 128) * 4k * 4 (times/sec) =
- * 1 (or 2) MB/s swapping bandwidth in low-priority
+ * a value of pager_daemon.tries_base / 256 or 16 = 2
+ * or 32 pages at a time.
+ * This gives us 2 (or 32) * 4k * 4 (times/sec) =
+ * 32 (or 512) KB/s swapping bandwidth in low-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
@@ -573,6 +573,8 @@
*/
tries = pager_daemon.tries_base;
tries >>= 4*free_memory_available();
+ if (tries < pager_daemon.tries_min)
+ tries = pager_daemon.tries_min;

do {
do_try_to_free_page(0);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/