5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29 /*
30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 * The Regents of the University of California
32 * All Rights Reserved
33 *
34 * University Acknowledgment- Portions of this document are derived from
35 * software developed by the University of California, Berkeley, and its
36 * contributors.
37 */
38
39 #include <sys/types.h>
40 #include <sys/t_lock.h>
41 #include <sys/param.h>
42 #include <sys/buf.h>
43 #include <sys/uio.h>
44 #include <sys/proc.h>
58 #include <sys/tnf_probe.h>
59 #include <sys/mem_cage.h>
60 #include <sys/time.h>
61
62 #include <vm/hat.h>
63 #include <vm/as.h>
64 #include <vm/seg.h>
65 #include <vm/page.h>
66 #include <vm/pvn.h>
67 #include <vm/seg_kmem.h>
68
69 static int checkpage(page_t *, int);
70
71 /*
72 * The following parameters control operation of the page replacement
73 * algorithm. They are initialized to 0, and then computed at boot time
74 * based on the size of the system. If they are patched non-zero in
75 * a loaded vmunix they are left alone and may thus be changed per system
76 * using adb on the loaded system.
77 */
78 pgcnt_t slowscan = 0;
79 pgcnt_t fastscan = 0;
80
81 static pgcnt_t handspreadpages = 0;
82 static int loopfraction = 2;
83 static pgcnt_t looppages;
84 static int min_percent_cpu = 4;
85 static int max_percent_cpu = 80;
86 static pgcnt_t maxfastscan = 0;
87 static pgcnt_t maxslowscan = 100;
88
89 pgcnt_t maxpgio = 0;
90 pgcnt_t minfree = 0;
91 pgcnt_t desfree = 0;
92 pgcnt_t lotsfree = 0;
93 pgcnt_t needfree = 0;
94 pgcnt_t throttlefree = 0;
95 pgcnt_t pageout_reserve = 0;
96
97 pgcnt_t deficit;
98 pgcnt_t nscan;
99 pgcnt_t desscan;
100
101 /*
102 * Values for min_pageout_ticks, max_pageout_ticks and pageout_ticks
103 * are the number of ticks in each wakeup cycle that gives the
104 * equivalent of some underlying %CPU duty cycle.
105 * When RATETOSCHEDPAGING is 4, and hz is 100, pageout_scanner is
106 * awakened every 25 clock ticks. So, converting from %CPU to ticks
107 * per wakeup cycle would be x% of 25, that is (x * 100) / 25.
108 * So, for example, 4% == 1 tick and 80% == 20 ticks.
109 *
110 * min_pageout_ticks:
111 * ticks/wakeup equivalent of min_percent_cpu.
112 *
113 * max_pageout_ticks:
114 * ticks/wakeup equivalent of max_percent_cpu.
115 *
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
31
32 /*
33 * University Copyright- Copyright (c) 1982, 1986, 1988
34 * The Regents of the University of California
35 * All Rights Reserved
36 *
37 * University Acknowledgment- Portions of this document are derived from
38 * software developed by the University of California, Berkeley, and its
39 * contributors.
40 */
41
42 #include <sys/types.h>
43 #include <sys/t_lock.h>
44 #include <sys/param.h>
45 #include <sys/buf.h>
46 #include <sys/uio.h>
47 #include <sys/proc.h>
61 #include <sys/tnf_probe.h>
62 #include <sys/mem_cage.h>
63 #include <sys/time.h>
64
65 #include <vm/hat.h>
66 #include <vm/as.h>
67 #include <vm/seg.h>
68 #include <vm/page.h>
69 #include <vm/pvn.h>
70 #include <vm/seg_kmem.h>
71
72 static int checkpage(page_t *, int);
73
74 /*
75 * The following parameters control operation of the page replacement
76 * algorithm. They are initialized to 0, and then computed at boot time
77 * based on the size of the system. If they are patched non-zero in
78 * a loaded vmunix they are left alone and may thus be changed per system
79 * using adb on the loaded system.
80 */
81 volatile pgcnt_t slowscan = 0;
82 volatile pgcnt_t fastscan = 0;
83
84 volatile pgcnt_t handspreadpages = 0;
85 static int loopfraction = 2;
86 static pgcnt_t looppages;
87 volatile int min_percent_cpu = 4;
88 static int max_percent_cpu = 80;
89 static pgcnt_t maxfastscan = 0;
90 static pgcnt_t maxslowscan = 100;
91
92 volatile pgcnt_t maxpgio = 0;
93 volatile pgcnt_t minfree = 0;
94 volatile pgcnt_t desfree = 0;
95 volatile pgcnt_t lotsfree = 0;
96 pgcnt_t needfree = 0;
97 volatile pgcnt_t throttlefree = 0;
98 volatile pgcnt_t pageout_reserve = 0;
99
100 pgcnt_t deficit;
101 pgcnt_t nscan;
102 pgcnt_t desscan;
103
104 /*
105 * Values for min_pageout_ticks, max_pageout_ticks and pageout_ticks
106 * are the number of ticks in each wakeup cycle that gives the
107 * equivalent of some underlying %CPU duty cycle.
108 * When RATETOSCHEDPAGING is 4, and hz is 100, pageout_scanner is
109 * awakened every 25 clock ticks. So, converting from %CPU to ticks
110 * per wakeup cycle would be x% of 25, that is (x * 100) / 25.
111 * So, for example, 4% == 1 tick and 80% == 20 ticks.
112 *
113 * min_pageout_ticks:
114 * ticks/wakeup equivalent of min_percent_cpu.
115 *
116 * max_pageout_ticks:
117 * ticks/wakeup equivalent of max_percent_cpu.
118 *
|