1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
'\" te
.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH MADV.SO.1 1 "Feb 15, 2002"
.SH NAME
madv.so.1 \- madv library
.SH SYNOPSIS
.LP
.nf
\fB/usr/lib/madv.so.1\fR
.fi
.SH DESCRIPTION
.sp
.LP
The \fBmadv.so.1\fR shared object provides a means by which the VM advice can
be selectively configured for a launched process (or processes) and its
descendants. To enable \fBmadv.so.1\fR, the following string needs to be
present in the environment (see \fBld.so.1\fR(1)) along with one or more
\fBMADV\fR environment variables:
.sp
.in +2
.nf
\fBLD_PRELOAD=$LD_PRELOAD:madv.so.1\fR
.fi
.in -2
.sp
.SH ENVIRONMENT VARIABLES
.sp
.LP
If the \fBmadv.so.1\fR shared object is specified in the \fBLD_PRELOAD\fR list,
the following environment variables are read by the \fBmadv\fR shared object to
determine to which created process(es) to apply the specified advice.
.sp
.ne 2
.na
\fB\fBMADV\fR=\fIadvice\fR \fR
.ad
.RS 27n
\fBMADV\fR specifies the VM advice to use for all heap, shared memory, and mmap
regions in the process address space. This advice is applied to
all created processes.
.sp
Values for \fIadvice\fR correspond to values in <sys/mman.h> used in
\fBmadvise\fR(3C) to specify memory access patterns:
.br
.in +2
normal
.in -2
.br
.in +2
random
.in -2
.br
.in +2
sequential
.in -2
.br
.in +2
access_lwp
.in -2
.br
.in +2
access_many
.in -2
.br
.in +2
access_default
.in -2
.RE
.sp
.ne 2
.na
\fB\fBMADVCFGFILE\fR=\fIconfig-file\fR\fR
.ad
.RS 27n
\fIconfig-file\fR is a text file which contains one or more \fBmadv\fR
configuration entries of the form:
.sp
.in +2
.nf
\fIexec-name\fR \fIexec-args\fR:\fIadvice-opts\fR
.fi
.in -2
.sp
Advice specified in \fIconfig-file\fR takes precedence over that specified by
the \fBMADV\fR environment variable. When \fBMADVCFGFILE\fR is not set, advice
is taken from file \fB/etc/madv.conf\fR if it exists.
.sp
\fIexec-name\fR specifies the name of an application or executable. The
corresponding advice is set for newly created processes (see
\fBgetexecname\fR(3C)) that match the first \fIexec-name\fR found in the file.
.sp
\fIexec-name\fR can be a full pathname, a base name, or a pattern string. See
\fBFile Name Generation\fR in \fBsh\fR(1) for a discussion of pattern matching.
.sp
\fIexec-args\fR is an optionally specified pattern string to match against
arguments. Advice is set only if \fIexec-args\fR is not specified or occurs
within the arguments to \fIexec-name\fR.
.sp
\fIadvice-opts\fR is a comma-separated list specifying the advice for various
memory region(s):
.sp
.ne 2
.na
\fB\fBmadv\fR=\fIadvice\fR\fR
.ad
.RS 21n
Applies to all heap, shared memory, and mmap regions in the process address
space.
.RE
.sp
.ne 2
.na
\fB\fBheap\fR=\fIadvice\fR\fR
.ad
.RS 21n
The heap is defined to be the brk area (see \fBbrk\fR(2)). Applies to the
existing heap and for any additional heap memory allocated in the future.
.RE
.sp
.ne 2
.na
\fB\fBshm\fR=\fIadvice\fR\fR
.ad
.br
.na
\fB\fBism\fR=\fIadvice\fR\fR
.ad
.br
.na
\fB\fBdism\fR=\fIadvice\fR\fR
.ad
.RS 21n
Shared memory segments (see \fBshmat\fR(2)) attached using any flags, flag
\fBSHM_SHARE_MMU\fR, or flag \fBSHM_PAGEABLE\fR respectively. Options
\fBism\fR and \fBdism\fR take precedence over option \fBshm\fR.
.RE
.sp
.ne 2
.na
\fB\fBmap\fR=\fIadvice\fR\fR
.ad
.br
.na
\fB\fBmapshared\fR=\fIadvice\fR\fR
.ad
.br
.na
\fB\fBmapprivate\fR=\fIadvice\fR\fR
.ad
.br
.na
\fB\fBmapanon\fR=\fIadvice\fR\fR
.ad
.RS 21n
Mappings established through \fBmmap\fR(2) using any flags, flag
\fBMAP_SHARED\fR, flag \fBMAP_PRIVATE\fR, or flag \fBMAP_ANON\fR, respectively.
Options \fBmapshared\fR, \fBmapprivate\fR, and \fBmapanon\fR take precedence
over option \fBmap\fR. Option \fBmapanon\fR takes precedence over
\fBmapshared\fR and \fBmapprivate\fR.
.RE
.RE
.sp
.ne 2
.na
\fB\fBMADVERRFILE\fR=\fIpathname\fR\fR
.ad
.RS 27n
By default, error messages are logged via \fBsyslog\fR(3C) using level
\fBLOG_ERR\fR and facility \fBLOG_USER\fR. If \fBMADVERRFILE\fR contains a
valid \fIpathname\fR (such as \fB/dev/stderr\fR), error messages will be logged
there instead.
.RE
.SH EXAMPLES
.LP
\fBExample 1 \fRApplying advice to all ISM segments
.sp
.LP
The following configuration applies advice to all ISM segments for application
\fB/usr/bin/foo\fR:
.sp
.in +2
.nf
example$ \fBLD_PRELOAD=$LD_PRELOAD:madv.so.1\fR
example$ \fBMADVCFGFILE=madvcfg\fR
example$ \fBexport LD_PRELOAD MADVCFGFILE\fR
example$ \fBcat $MADVCFGFILE\fR
/usr/bin/foo:ism=access_lwp
.fi
.in -2
.sp
.LP
\fBExample 2 \fRSetting advice for all applications with exception
.sp
.LP
The following configuration sets advice for all applications with the exception
of \fBls\fR.
.sp
.in +2
.nf
example$ \fBLD_PRELOAD=$LD_PRELOAD:madv.so.1\fR
example$ \fBMADV=access_many\fR
example$ \fBMADVCFGFILE=madvcfg\fR
example$ \fBexport LD_PRELOAD MADV MADVCFGFILE\fR
example$ \fBcat $MADVCFGFILE\fR
ls:
.fi
.in -2
.sp
.LP
\fBExample 3 \fRPrecedence rules (continuation from Example 2)
.sp
.LP
Because \fBMADVCFGFILE\fR takes precedence over \fBMADV\fR,
specifying '\fB*\fR' (pattern match all) for the \fIexec-name\fR of the last \fBmadv\fR
configuration entry would be equivalent to setting \fBMADV\fR. The following is
equivalent to example 2:
.sp
.in +2
.nf
example$ \fBLD_PRELOAD=$LD_PRELOAD:madv.so.1\fR
example$ \fBMADVCFGFILE=madvcfg\fR
example$ \fBexport LD_PRELOAD MADVCFGFILE\fR
example$ \fBcat $MADVCFGFILE\fR
ls:
*:madv=access_many
.fi
.in -2
.sp
.LP
\fBExample 4 \fRApplying advice for different regions
.sp
.LP
The following configuration applies one type of advice for mmap regions and
different advice for heap and shared memory regions for a select set of
applications with exec names that begin with \fBfoo\fR:
.sp
.in +2
.nf
example$ \fBLD_PRELOAD=$LD_PRELOAD:madv.so.1\fR
example$ \fBMADVCFGFILE=madvcfg\fR
example$ \fBexport LD_PRELOAD MADVCFGFILE\fR
example$ \fBcat $MADVCFGFILE\fR
foo*:madv=access_many,heap=sequential,shm=access_lwp
.fi
.in -2
.sp
.LP
\fBExample 5 \fRApplying advice selectively
.sp
.LP
The following configuration applies advice for the heap of applications
beginning with \fBora\fR that have \fBora1\fR as an argument:
.sp
.in +2
.nf
example$ \fBLD_PRELOAD=$LD_PRELOAD:madv.so.1\fR
example$ \fBMADVCFGFILE=madvcfg\fR
example$ \fBexport LD_PRELOAD MADVCFGFILE\fR
example$ \fBcat $MADVCFGFILE\fR
ora* ora1:heap=access_many
.fi
.in -2
.sp
.SH FILES
.sp
.ne 2
.na
\fB\fB/etc/madv.conf\fR \fR
.ad
.RS 19n
Configuration file
.RE
.SH SEE ALSO
.sp
.LP
\fBcat\fR(1), \fBld.so.1\fR(1), \fBproc\fR(1), \fBsh\fR(1), \fBbrk\fR(2),
\fBexec\fR(2), \fBfork\fR(2), \fBmmap\fR(2), \fBmemcntl\fR(2), \fBshmat\fR(2),
\fBgetexecname\fR(3C), \fBmadvise\fR(3C), \fBsyslog\fR(3C), \fBproc\fR(4),
\fBattributes\fR(5)
.SH NOTES
.sp
.LP
The advice is inherited. A child process has the same advice as its
parent. On \fBexec()\fR (see \fBexec\fR(2)), the advice is set back to the
default system advice unless different advice has been configured via the
\fBmadv\fR shared object.
.sp
.LP
Advice is only applied to \fBmmap\fR regions explicitly created by the user
program. Those regions established by the run-time linker or by system
libraries making direct system calls (for example, libthread allocations for
thread stacks) are not affected.
|