Deleted Added
full compact
madvise.2 (118684) madvise.2 (131504)
1.\" Copyright (c) 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
1.\" Copyright (c) 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
33.\" $FreeBSD: head/lib/libc/sys/madvise.2 118684 2003-08-09 03:23:24Z bms $
33.\" $FreeBSD: head/lib/libc/sys/madvise.2 131504 2004-07-02 23:52:20Z ru $
34.\"
35.Dd July 19, 1996
36.Dt MADVISE 2
37.Os
38.Sh NAME
39.Nm madvise , posix_madvise
40.Nd give advice about use of memory
41.Sh LIBRARY

--- 23 unchanged lines hidden (view full) ---

65Is a hint that pages will be accessed randomly, and prefetching
66is likely not advantageous.
67.It Dv MADV_SEQUENTIAL
68Causes the VM system to depress the priority of
69pages immediately preceding a given page when it is faulted in.
70.It Dv MADV_WILLNEED
71Causes pages that are in a given virtual address range
72to temporarily have higher priority, and if they are in
34.\"
35.Dd July 19, 1996
36.Dt MADVISE 2
37.Os
38.Sh NAME
39.Nm madvise , posix_madvise
40.Nd give advice about use of memory
41.Sh LIBRARY

--- 23 unchanged lines hidden (view full) ---

65Is a hint that pages will be accessed randomly, and prefetching
66is likely not advantageous.
67.It Dv MADV_SEQUENTIAL
68Causes the VM system to depress the priority of
69pages immediately preceding a given page when it is faulted in.
70.It Dv MADV_WILLNEED
71Causes pages that are in a given virtual address range
72to temporarily have higher priority, and if they are in
73memory, decrease the likelihood of them being freed. Additionally,
73memory, decrease the likelihood of them being freed.
74Additionally,
74the pages that are already in memory will be immediately mapped into
75the process, thereby eliminating unnecessary overhead of going through
75the pages that are already in memory will be immediately mapped into
76the process, thereby eliminating unnecessary overhead of going through
76the entire process of faulting the pages in. This WILL NOT fault
77the entire process of faulting the pages in.
78This WILL NOT fault
77pages in from backing store, but quickly map the pages already in memory
78into the calling process.
79.It Dv MADV_DONTNEED
80Allows the VM system to decrease the in-memory priority
79pages in from backing store, but quickly map the pages already in memory
80into the calling process.
81.It Dv MADV_DONTNEED
82Allows the VM system to decrease the in-memory priority
81of pages in the specified range. Additionally future references to
83of pages in the specified range.
84Additionally future references to
82this address range will incur a page fault.
83.It Dv MADV_FREE
84Gives the VM system the freedom to free pages,
85and tells the system that information in the specified page range
85this address range will incur a page fault.
86.It Dv MADV_FREE
87Gives the VM system the freedom to free pages,
88and tells the system that information in the specified page range
86is no longer important. This is an efficient way of allowing
89is no longer important.
90This is an efficient way of allowing
87.Xr malloc 3
88to free pages anywhere in the address space, while keeping the address space
91.Xr malloc 3
92to free pages anywhere in the address space, while keeping the address space
89valid. The next time that the page is referenced, the page might be demand
93valid.
94The next time that the page is referenced, the page might be demand
90zeroed, or might contain the data that was there before the
91.Dv MADV_FREE
92call.
93References made to that address space range will not make the VM system
94page the information back in from backing store until the page is
95modified again.
96.It Dv MADV_NOSYNC
97Request that the system not flush the data associated with this map to
95zeroed, or might contain the data that was there before the
96.Dv MADV_FREE
97call.
98References made to that address space range will not make the VM system
99page the information back in from backing store until the page is
100modified again.
101.It Dv MADV_NOSYNC
102Request that the system not flush the data associated with this map to
98physical backing store unless it needs to. Typically this prevents the
103physical backing store unless it needs to.
104Typically this prevents the
99file system update daemon from gratuitously writing pages dirtied
105file system update daemon from gratuitously writing pages dirtied
100by the VM system to physical disk. Note that VM/file system coherency is
106by the VM system to physical disk.
107Note that VM/file system coherency is
101always maintained, this feature simply ensures that the mapped data is
102only flush when it needs to be, usually by the system pager.
103.Pp
104This feature is typically used when you want to use a file-backed shared
105memory area to communicate between processes (IPC) and do not particularly
106need the data being stored in that area to be physically written to disk.
107With this feature you get the equivalent performance with mmap that you
108would expect to get with SysV shared memory calls, but in a more controllable
108always maintained, this feature simply ensures that the mapped data is
109only flush when it needs to be, usually by the system pager.
110.Pp
111This feature is typically used when you want to use a file-backed shared
112memory area to communicate between processes (IPC) and do not particularly
113need the data being stored in that area to be physically written to disk.
114With this feature you get the equivalent performance with mmap that you
115would expect to get with SysV shared memory calls, but in a more controllable
109and less restrictive manner. However, note that this feature is not portable
116and less restrictive manner.
117However, note that this feature is not portable
110across UNIX platforms (though some may do the right thing by default).
111For more information see the MAP_NOSYNC section of
112.Xr mmap 2
113.It Dv MADV_AUTOSYNC
114Undoes the effects of MADV_NOSYNC for any future pages dirtied within the
118across UNIX platforms (though some may do the right thing by default).
119For more information see the MAP_NOSYNC section of
120.Xr mmap 2
121.It Dv MADV_AUTOSYNC
122Undoes the effects of MADV_NOSYNC for any future pages dirtied within the
115address range. The effect on pages already dirtied is indeterminate - they
116may or may not be reverted. You can guarantee reversion by using the
123address range.
124The effect on pages already dirtied is indeterminate - they
125may or may not be reverted.
126You can guarantee reversion by using the
117.Xr msync 2
118or
119.Xr fsync 2
120system calls.
121.It Dv MADV_NOCORE
122Region is not included in a core file.
123.It Dv MADV_CORE
124Include region in a core file.

--- 52 unchanged lines hidden ---
127.Xr msync 2
128or
129.Xr fsync 2
130system calls.
131.It Dv MADV_NOCORE
132Region is not included in a core file.
133.It Dv MADV_CORE
134Include region in a core file.

--- 52 unchanged lines hidden ---