Make TMPFS_PAGES_MINRESERVED a kernel option

TMPFS_PAGES_MINRESERVED controls how much memory is reserved for the system
and not used by tmpfs.

On very small memory systems, the default value may be too high and this
prevents these small memory systems from using reroot, which is required
for them to install firmware updates.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	mizhka
Differential Revision:	https://reviews.freebsd.org/D13583
This commit is contained in:
Allan Jude 2019-03-25 07:46:20 +00:00
parent 07c9bf2a44
commit b4b3e3498b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345491
4 changed files with 9 additions and 1 deletions

View File

@ -640,6 +640,9 @@ NFS_MINDIRATTRTIMO opt_nfs.h
NFS_MAXDIRATTRTIMO opt_nfs.h
NFS_DEBUG opt_nfs.h
# TMPFS options
TMPFS_PAGES_MINRESERVED opt_tmpfs.h
# For the Bt848/Bt848A/Bt849/Bt878/Bt879 driver
OVERRIDE_CARD opt_bktr.h
OVERRIDE_TUNER opt_bktr.h

View File

@ -487,7 +487,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode,
* Amount of memory pages to reserve for the system (e.g., to not use by
* tmpfs).
*/
#if !defined(TMPFS_PAGES_MINRESERVED)
#define TMPFS_PAGES_MINRESERVED (4 * 1024 * 1024 / PAGE_SIZE)
#endif
size_t tmpfs_mem_avail(void);

View File

@ -42,6 +42,9 @@
* memory-specific data structures and algorithms to automatically
* allocate and release resources.
*/
#include "opt_tmpfs.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

View File

@ -4,6 +4,6 @@
KMOD= tmpfs
SRCS= vnode_if.h \
tmpfs_vnops.c tmpfs_fifoops.c tmpfs_vfsops.c tmpfs_subr.c
tmpfs_vnops.c tmpfs_fifoops.c tmpfs_vfsops.c tmpfs_subr.c opt_tmpfs.h
.include <bsd.kmod.mk>