Skip to content

Commit 253e5df

Browse files
Hugh Dickinsakpm00
authored andcommitted
tmpfs: fix Documentation of noswap and huge mount options
The noswap mount option is surely not one of the three options for sizing: move its description down. The huge= mount option does not accept numeric values: those are just in an internal enum. Delete those numbers, and follow the manpage text more closely (but there's not yet any fadvise() or fcntl() which applies here). /sys/kernel/mm/transparent_hugepage/shmem_enabled is hard to describe, and barely relevant to mounting a tmpfs: just refer to transhuge.rst (while still using the words deny and force, to help as informal reminders). [[email protected]: fixup Docs table for huge mount options] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Hugh Dickins <[email protected]> Signed-off-by: Randy Dunlap <[email protected]> Fixes: d0f5a85 ("shmem: update documentation") Fixes: 2c6efe9 ("shmem: add support to ignore swap") Reviewed-by: Luis Chamberlain <[email protected]> Cc: Christian Brauner <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent dddfa05 commit 253e5df

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

Documentation/filesystems/tmpfs.rst

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ nr_inodes The maximum number of inodes for this instance. The default
8484
is half of the number of your physical RAM pages, or (on a
8585
machine with highmem) the number of lowmem RAM pages,
8686
whichever is the lower.
87-
noswap Disables swap. Remounts must respect the original settings.
88-
By default swap is enabled.
8987
========= ============================================================
9088

9189
These parameters accept a suffix k, m or g for kilo, mega and giga and
@@ -99,36 +97,31 @@ mount with such options, since it allows any user with write access to
9997
use up all the memory on the machine; but enhances the scalability of
10098
that instance in a system with many CPUs making intensive use of it.
10199

100+
tmpfs blocks may be swapped out, when there is a shortage of memory.
101+
tmpfs has a mount option to disable its use of swap:
102+
103+
====== ===========================================================
104+
noswap Disables swap. Remounts must respect the original settings.
105+
By default swap is enabled.
106+
====== ===========================================================
107+
102108
tmpfs also supports Transparent Huge Pages which requires a kernel
103109
configured with CONFIG_TRANSPARENT_HUGEPAGE and with huge supported for
104110
your system (has_transparent_hugepage(), which is architecture specific).
105111
The mount options for this are:
106112

107-
====== ============================================================
108-
huge=0 never: disables huge pages for the mount
109-
huge=1 always: enables huge pages for the mount
110-
huge=2 within_size: only allocate huge pages if the page will be
111-
fully within i_size, also respect fadvise()/madvise() hints.
112-
huge=3 advise: only allocate huge pages if requested with
113-
fadvise()/madvise()
114-
====== ============================================================
115-
116-
There is a sysfs file which you can also use to control system wide THP
117-
configuration for all tmpfs mounts, the file is:
118-
119-
/sys/kernel/mm/transparent_hugepage/shmem_enabled
120-
121-
This sysfs file is placed on top of THP sysfs directory and so is registered
122-
by THP code. It is however only used to control all tmpfs mounts with one
123-
single knob. Since it controls all tmpfs mounts it should only be used either
124-
for emergency or testing purposes. The values you can set for shmem_enabled are:
125-
126-
== ============================================================
127-
-1 deny: disables huge on shm_mnt and all mounts, for
128-
emergency use
129-
-2 force: enables huge on shm_mnt and all mounts, w/o needing
130-
option, for testing
131-
== ============================================================
113+
================ ==============================================================
114+
huge=never Do not allocate huge pages. This is the default.
115+
huge=always Attempt to allocate huge page every time a new page is needed.
116+
huge=within_size Only allocate huge page if it will be fully within i_size.
117+
Also respect madvise(2) hints.
118+
huge=advise Only allocate huge page if requested with madvise(2).
119+
================ ==============================================================
120+
121+
See also Documentation/admin-guide/mm/transhuge.rst, which describes the
122+
sysfs file /sys/kernel/mm/transparent_hugepage/shmem_enabled: which can
123+
be used to deny huge pages on all tmpfs mounts in an emergency, or to
124+
force huge pages on all tmpfs mounts for testing.
132125

133126
tmpfs has a mount option to set the NUMA memory allocation policy for
134127
all files in that instance (if CONFIG_NUMA is enabled) - which can be

0 commit comments

Comments
 (0)