Import 2.1.116pre1
[davej-history.git] / mm / swap.c
blob3cedb215c8b710eb2228d42d6387e8dc5106e883
1 /*
2 * linux/mm/swap.c
4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
5 */
7 /*
8 * This file contains the default values for the opereation of the
9 * Linux VM subsystem. Fine-tuning documentation can be found in
10 * linux/Documentation/sysctl/vm.txt.
11 * Started 18.12.91
12 * Swap aging added 23.2.95, Stephen Tweedie.
13 * Buffermem limits added 12.3.98, Rik van Riel.
16 #include <linux/mm.h>
17 #include <linux/sched.h>
18 #include <linux/head.h>
19 #include <linux/kernel.h>
20 #include <linux/kernel_stat.h>
21 #include <linux/errno.h>
22 #include <linux/string.h>
23 #include <linux/stat.h>
24 #include <linux/swap.h>
25 #include <linux/fs.h>
26 #include <linux/swapctl.h>
27 #include <linux/pagemap.h>
28 #include <linux/init.h>
30 #include <asm/dma.h>
31 #include <asm/system.h> /* for cli()/sti() */
32 #include <asm/uaccess.h> /* for copy_to/from_user */
33 #include <asm/bitops.h>
34 #include <asm/pgtable.h>
37 * We identify three levels of free memory. We never let free mem
38 * fall below the freepages.min except for atomic allocations. We
39 * start background swapping if we fall below freepages.high free
40 * pages, and we begin intensive swapping below freepages.low.
42 * These values are there to keep GCC from complaining. Actual
43 * initialization is done in mm/page_alloc.c or arch/sparc(64)/mm/init.c.
45 freepages_t freepages = {
46 48, /* freepages.min */
47 96, /* freepages.low */
48 144 /* freepages.high */
51 /* We track the number of pages currently being asynchronously swapped
52 out, so that we don't try to swap TOO many pages out at once */
53 atomic_t nr_async_pages = ATOMIC_INIT(0);
56 * Constants for the page aging mechanism: the maximum age (actually,
57 * the maximum "youthfulness"); the quanta by which pages rejuvenate
58 * and age; and the initial age for new pages.
61 swap_control_t swap_control = {
62 20, 3, 1, 3, /* Page aging */
63 32, 4, /* Aging cluster */
64 8192, 8192, /* Pageout and bufferout weights */
67 swapstat_t swapstats = {0};
69 buffer_mem_t buffer_mem = {
70 5, /* minimum percent buffer */
71 25, /* borrow percent buffer */
72 50 /* maximum percent buffer */
75 buffer_mem_t page_cache = {
76 10, /* minimum percent page cache */
77 30, /* borrow percent page cache */
78 75 /* maximum */
81 pager_daemon_t pager_daemon = {
82 512, /* base number for calculating the number of tries */
83 SWAP_CLUSTER_MAX, /* minimum number of tries */
84 SWAP_CLUSTER_MAX, /* do swap I/O in clusters of this size */