-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
-.\" Copyright (C) 2001 David Gómez <davidge@jazzfree.com>
+.\" Copyright (C) 2001 David Gómez <davidge@jazzfree.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Based on comments from mm/filemap.c. Last modified on 10-06-2001
.\" Modified, 25 Feb 2002, Michael Kerrisk, <mtk.manpages@gmail.com>
.\" 2011-09-18, Doug Goldstein <cardoe@cardoe.com>
.\" Document MADV_HUGEPAGE and MADV_NOHUGEPAGE
.\"
-.TH MADVISE 2 2012-04-28 "Linux" "Linux Programmer's Manual"
+.TH MADVISE 2 2014-04-20 "Linux" "Linux Programmer's Manual"
.SH NAME
madvise \- give advice about use of memory
.SH SYNOPSIS
or zero-fill-on-demand pages for mappings
without an underlying file.
.TP
-.BR MADV_REMOVE " (Since Linux 2.6.16)"
+.BR MADV_REMOVE " (since Linux 2.6.16)"
Free up a given range of pages
and its associated backing store.
Currently,
.\" 2.6.18-rc5
-only shmfs/tmpfs supports this; other file systems return with the
+only shmfs/tmpfs supports this; other filesystems return with the
error
.BR ENOSYS .
.\" Databases want to use this feature to drop a section of their
.\" disk/swap space. This feature is also useful for supporting
.\" hot-plug memory on UML.
.TP
-.BR MADV_DONTFORK " (Since Linux 2.6.16)"
+.BR MADV_DONTFORK " (since Linux 2.6.16)"
.\" See http://lwn.net/Articles/171941/
Do not make the pages in this range available to the child after a
.BR fork (2).
.\" SEE ALSO: http://lwn.net/Articles/171941/
.\" "Tweaks to madvise() and posix_fadvise()", 14 Feb 2006
.TP
-.BR MADV_DOFORK " (Since Linux 2.6.16)"
+.BR MADV_DOFORK " (since Linux 2.6.16)"
Undo the effect of
.BR MADV_DONTFORK ,
restoring the default behavior, whereby a mapping is inherited across
.BR fork (2).
.TP
-.BR MADV_HWPOISON " (Since Linux 2.6.32)
+.BR MADV_HWPOISON " (since Linux 2.6.32)
Poison a page and handle it like a hardware memory corruption.
-This operation is only available for privileged
+This operation is available only for privileged
.RB ( CAP_SYS_ADMIN )
processes.
This operation may result in the calling process receiving a
.B SIGBUS
and the page being unmapped.
This feature is intended for testing of memory error-handling code;
-it is only available if the kernel was configured with
+it is available only if the kernel was configured with
.BR CONFIG_MEMORY_FAILURE .
.TP
-.BR MADV_SOFT_OFFLINE " (Since Linux 2.6.33)
+.BR MADV_SOFT_OFFLINE " (since Linux 2.6.33)
Soft offline the pages in the range specified by
.I addr
and
operation is invisible to (i.e., does not change the semantics of)
the calling process.
This feature is intended for testing of memory error-handling code;
-it is only available if the kernel was configured with
+it is available only if the kernel was configured with
.BR CONFIG_MEMORY_FAILURE .
.TP
.BR MADV_MERGEABLE " (since Linux 2.6.32)"
looking for pages with identical content.
These are replaced by a single write-protected page (which is automatically
copied if a process later wants to update the content of the page).
-KSM only merges private anonymous pages (see
+KSM merges only private anonymous pages (see
.BR mmap (2)).
The KSM feature is intended for applications that generate many
instances of the same data (e.g., virtualization systems such as KVM).
It can consume a lot of processing power; use with care.
-See the kernel source file
+See the Linux kernel source file
.I Documentation/vm/ksm.txt
for more details.
The
.BR MADV_MERGEABLE
and
.BR MADV_UNMERGEABLE
-operations are only available if the kernel was configured with
+operations are available only if the kernel was configured with
.BR CONFIG_KSM .
.TP
.BR MADV_UNMERGEABLE " (since Linux 2.6.32)"
.I addr
and
.IR length .
-Currently, Transparent Huge Pages only work with private anonymous pages (see
+Currently, Transparent Huge Pages work only with private anonymous pages (see
.BR mmap (2)).
The kernel will regularly scan the areas marked as huge page candidates
to replace them with huge pages.
systems such as QEMU).
It can very easily waste memory (e.g., a 2MB mapping that only ever accesses
1 byte will result in 2MB of wired memory instead of one 4KB page).
-See the kernel source file
+See the Linux kernel source file
.I Documentation/vm/transhuge.txt
for more details.
The
.BR MADV_HUGEPAGE
and
.BR MADV_NOHUGEPAGE
-operations are only available if the kernel was configured with
+operations are available only if the kernel was configured with
.BR CONFIG_TRANSPARENT_HUGEPAGE .
.TP
.BR MADV_NOHUGEPAGE " (since Linux 2.6.38)"
.BR MADV_DODUMP " (since Linux 3.4)"
Undo the effect of an earlier
.BR MADV_DONTDUMP .
-.SH "RETURN VALUE"
+.SH RETURN VALUE
On success
.BR madvise ()
returns zero.
.B ENOMEM
Addresses in the specified range are not currently
mapped, or are outside the address space of the process.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
POSIX.1b.
POSIX.1-2001 describes
.BR posix_madvise (3)
.\" FIXME . Write a posix_madvise(3) page.
with constants
.BR POSIX_MADV_NORMAL ,
-etc.,
+.BR POSIX_MADV_RANDOM ,
+and so on,
with a behavior close to that described here.
There is a similar
.BR posix_fadvise (2)
.BR MADV_UNMERGEABLE
are Linux-specific.
.SH NOTES
-.SS "Linux Notes"
+.SS Linux notes
.LP
The current Linux implementation (2.4.0) views this system call
more as a command than as advice and hence may return an error
.\" The
.\" .BR madvise ()
.\" function first appeared in 4.4BSD.
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR getrlimit (2),
.BR mincore (2),
.BR mmap (2),
.BR mprotect (2),
.BR msync (2),
.BR munmap (2),
+.BR prctl (2),
.BR core (5)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.