From 75cdc755a6a127d7019fc5700872450ef9ca1367 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 21 Feb 2010 23:42:12 -0800 Subject: [PATCH] chflags, swapcache manual page updates - cache flag does not cross mounts * The cache and noscache flags do not cross mount points any more. --- share/man/man8/swapcache.8 | 30 ++++++++++++++++++++++-------- usr.bin/chflags/chflags.1 | 15 ++++++++++----- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/share/man/man8/swapcache.8 b/share/man/man8/swapcache.8 index be4ca915d1..92d63d9ec8 100644 --- a/share/man/man8/swapcache.8 +++ b/share/man/man8/swapcache.8 @@ -28,6 +28,7 @@ data and meta-data. .Cd sysctl vm.swapcache.data_enable=0 .Cd sysctl vm.swapcache.use_chflags=1 .Cd sysctl vm.swapcache.maxlaunder=256 +.Cd sysctl vm.swapcache.hysteresis=(vm.stats.vm.v_inactive_target/2) .Sh DESCRIPTION .Nm is a system capability which allows a solid state disk (SSD) in a swap @@ -78,6 +79,19 @@ operation. controls which files are to be cached based on their size. If set to non-zero only files smaller than the specified size will be cached. Larger files will not be cached. +.Pp +.Cd vm.swapcache.maxlaunder +controls the maximum number of clean VM pages which will be added to +the swap cache and written out to swap on each poll. +Swapcache polls ten times a second. +.Pp +.Cd vm.swapcache.hysteresis +controls how many pages swapcache waits to be added to the inactive page +queue before continuing its scan. Once it decides to scan it continues +subject to the above limitations until it reaches the end of the inactive +page queue. +This parameter is designed to make swapcache generate more bulky bursts +to swap which helps SSDs reduce write amplification effects. .Sh PERFORMANCE TUNING Best operation is achieved when the active data set fits within the swapcache. @@ -159,23 +173,23 @@ with the flag to enable data caching on a directory. This flag is tracked by the namecache and does not need to be recursively set in the directory tree. -Simply setting the flag in a top level directory is sufficient. +Simply setting the flag in a top level directory or mount point +is usually sufficient. +However, the flag does not track across mount points. A typical setup is something like this: .Pp .Dl chflags cache /etc /sbin /bin /usr /home .Dl chflags noscache /usr/obj .Pp -Alternatively if you have NFS mounts where chflags does not work you -can enable caching in some parent directory, then selectively disable -it. -.Pp -.Dl chflags cache / -.Dl chflags noscache /usr/obj /tmp /var/tmp -.Pp If that doesn't work you can turn off .Cd vm.swapcache.use_chflags entirely and not bother with any chflagging. .Pp +Filesystems such as NFS which do not support flags generally +have a +.Cd cache +mount option which enables swapcache operation on the mount. +.Pp .It Cd vm.swapcache.maxfilesize This may be used to reduce cache thrashing when a focus on a small potentially fragmented filespace is desired, leaving the diff --git a/usr.bin/chflags/chflags.1 b/usr.bin/chflags/chflags.1 index f7fc8c8dbc..f3e903216c 100644 --- a/usr.bin/chflags/chflags.1 +++ b/usr.bin/chflags/chflags.1 @@ -127,7 +127,7 @@ set the user immutable flag (owner or super-user only) .It Cm uunlnk , uunlink set the user undeletable flag (owner or super-user only) .It Cm cache , ucache, snocache -control the data swapcache (recursive) +control the data swapcache (recursive, does not cross mounts) .El .Pp Putting the letters @@ -214,15 +214,20 @@ The superuser flag, may be used to disable swapcache data caching and overrides the user flag. .Pp -The flag is recursive and need only be set on a top-level directory -to automatically apply to the entire subtree, though you may have -to refresh the namecache with a dummy +The flag is recursive but does not cross mount points. +Setting it on a top-level directories or mount point will +automatically apply the flag to the entire subtree or until +a mount point is hit. +You may have to refresh the namecache with a dummy .Xr find 1 -command. +command after changing the flag in a top level directory. You do not have to recursive set the flag with .Nm .Op R and, in fact, we do not recommend it under any circumstances. +Filesystems which do not support flags generally have a +.Cm cache +mount option to enable swapcache operation on the mount. .Pp If you intend to use swapcache data the .Cm vm.swapcache.use_chflags -- 2.41.0