How can I stop the flushing of mmaped pages to disk in Linux?
The /proc/sys/vm/flush_mmap_pages Linux kernel parameter specifies whether or not memory-mapped file pages should be flushed to disk by kupdate while the memory map is active. Valid values for this parameter are 1 (enable memory mapping by kupdate) and 0 (disable memory mapping by kupdate). The default value for this parameter is 1. To configure this parameter, use echo [1 or 0] /proc/sys/vm/flush_mmap_pages. Setting this parameter to 0 does the following (quoting from the official documentation):
- kupdate will not flush dirty memory-mapped file pages as long as the memory map is active.
- All dirty file pages will be asynchronously flushed to disk only as soon as the memory map is deactivated.
If you set /proc/sys/vm/flush_mmap_pages to 0, it is advisable that you use another application to manually sync memory-mapped pages to disk. So to stop the flushing of mmaped pages to disk in Linux, enter:
sysctl -w /proc/sys/vm/flush_mmap_pages=0
All dirty file pages will be asynchronously flushed to disk only as soon as the memory map is deactivated. To enable memory mapping again, enter:
sysctl -w /proc/sys/vm/flush_mmap_pages=1
Add the following line to /etc/sysctl.conf:
echo 0 >/proc/sys/vm/flush_mmap_pages
🐧 1 comment so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
under Ubuntu 12.10,this parameter was gone, is there any other parameter I can use?