* added 0.99 linux version
[mascara-docs.git] / i386 / linux / linux-2.3.21 / mm / swap.c
blob1d6b0d4d041d77719c8f54de4422b29506af6884
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/kernel_stat.h>
18 #include <linux/swap.h>
19 #include <linux/swapctl.h>
20 #include <linux/pagemap.h>
21 #include <linux/init.h>
23 #include <asm/dma.h>
24 #include <asm/uaccess.h> /* for copy_to/from_user */
25 #include <asm/pgtable.h>
28 * We identify three levels of free memory. We never let free mem
29 * fall below the freepages.min except for atomic allocations. We
30 * start background swapping if we fall below freepages.high free
31 * pages, and we begin intensive swapping below freepages.low.
33 * These values are there to keep GCC from complaining. Actual
34 * initialization is done in mm/page_alloc.c or arch/sparc(64)/mm/init.c.
36 freepages_t freepages = {
37 48, /* freepages.min */
38 96, /* freepages.low */
39 144 /* freepages.high */
42 /* How many pages do we try to swap or page in/out together? */
43 int page_cluster = 4; /* Default value modified in swap_setup() */
45 /* We track the number of pages currently being asynchronously swapped
46 out, so that we don't try to swap TOO many pages out at once */
47 atomic_t nr_async_pages = ATOMIC_INIT(0);
49 buffer_mem_t buffer_mem = {
50 2, /* minimum percent buffer */
51 10, /* borrow percent buffer */
52 60 /* maximum percent buffer */
55 buffer_mem_t page_cache = {
56 2, /* minimum percent page cache */
57 15, /* borrow percent page cache */
58 75 /* maximum */
61 pager_daemon_t pager_daemon = {
62 512, /* base number for calculating the number of tries */
63 SWAP_CLUSTER_MAX, /* minimum number of tries */
64 SWAP_CLUSTER_MAX, /* do swap I/O in clusters of this size */
68 * Perform any setup for the swap system
71 void __init swap_setup(void)
73 /* Use a smaller cluster for memory <16MB or <32MB */
74 if (num_physpages < ((16 * 1024 * 1024) >> PAGE_SHIFT))
75 page_cluster = 2;
76 else if (num_physpages < ((32 * 1024 * 1024) >> PAGE_SHIFT))
77 page_cluster = 3;
78 else
79 page_cluster = 4;