.\" 2007-06-22 Ivana Varekova <varekova@redhat.com>, mtk
.\" Update text describing limit on number of swap files.
.\"
-.TH SWAPON 2 2014-05-28 "Linux" "Linux Programmer's Manual"
+.\" FIXME Linux 3.11 added SWAP_FLAG_DISCARD_ONCE and SWAP_FLAG_DISCARD_PAGES
+.\" commit dcf6b7ddd7df8965727746f89c59229b23180e5a
+.\" Author: Rafael Aquini <aquini@redhat.com>
+.\" Date: Wed Jul 3 15:02:46 2013 -0700
+.\"
+.TH SWAPON 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.SH NAME
swapon, swapoff \- start/stop swapping to file/device
.SH SYNOPSIS
.B #include <unistd.h>
.br
.B #include <sys/swap.h>
-.sp
+.PP
.BI "int swapon(const char *" path ", int " swapflags );
.br
.BI "int swapoff(const char *" path );
The priority is encoded within
.I swapflags
as:
-.br
-.sp
-.I " (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK"
-.br
+.PP
+.in +4n
+.EX
+.I "(prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK"
+.EE
+.in
.PP
If the
.B SWAP_FLAG_DISCARD
.B EINVAL
.RB ( swapon ())
The indicated path does not contain a valid swap signature or
-resides on an in-memory filesystem such as tmpfs.
+resides on an in-memory filesystem such as
+.BR tmpfs (5).
.TP
.BR EINVAL " (since Linux 3.4)"
.RB ( swapon ())
is not currently a swap area.
.TP
.B ENFILE
-The system limit on the total number of open files has been reached.
+The system-wide limit on the total number of open files has been reached.
.TP
.B ENOENT
The file
.SH NOTES
The partition or path must be prepared with
.BR mkswap (8).
-
+.PP
There is an upper limit on the number of swap files that may be used,
defined by the kernel constant
.BR MAX_SWAPFILES .
if the kernel is built with the
.B CONFIG_MEMORY_FAILURE
option.
-
+.PP
Discard of swap pages was introduced in kernel 2.6.29,
then made conditional
on the