optimize pagedaemon settings

Rozhuk Ivan <[email protected]> Wed, 3 Jun 2026 02:33:00 +0300
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
Hi!


Is it possible to tune something in sysctl to reduce CPU usage by "pagedaemon" and convert more "Laundry" to "Free"?



....
Mem: 25G Active, 242M Inact, 67G Laundry, 31G Wired, 1505M Buf, 878M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
65951 nobody       33 141    0    36G    33G CPU16   16  63.2H 2711.41% /usr/local/bin/llama-server --cpu-strict 1 --host 127.0.0.1 --mmap --no-host --offline --
    7 root          3 -15    -     0B    72K CPU0     0 766:00 100.06% [pagedaemon]
 1086 rim          44 111    0  8555M  4020M CPU24   24  32.1H  97.92% /usr/local/lib/firefox/firefox -contentproc -isForBrowser -prefsHandle 0:49179 -prefMapHan
98907 rim         384   1    0    46G    13G select   9  42.6H  58.60% /usr/local/bin/firefox -P default
84880 rim          47  29    0   801M   253M select   3   4:45  44.80% iridium: --type=gpu-process --ozone-platform=x11 --enable-crash-reporter=, --change-stack-
....


My current settings:
vm.cluster_anon=2			# Cluster anonymous mappings: 0 = no, 1 = yes if no hint, 2 = always // def: 1
vm.overcommit=0				# Configure virtual memory overcommit behavior. See tuning(7) for details.
vm.pageout_update_period=20		# Maximum active LRU update period (seconds)
vm.lowmem_period=2			# Low memory callback period (seconds)
vm.act_scan_laundry_weight=16		# weight given to clean vs. dirty pages in active queue scans / def: 3
vm.background_launder_rate=65536	# background laundering rate, in kilobytes per second / def: 4096
vm.background_launder_max=524288	# background laundering cap, in kilobytes / def: 20*1024
vm.domain.0.pageout_helper_threads_enabled=1 # Enable multi-threaded inactive queue scanning / see also vm.pageout_cpus_per_thread / def: 1
vm.domain.1.pageout_helper_threads_enabled=1 # Enable multi-threaded inactive queue scanning / see also vm.pageout_cpus_per_thread / def: 1
vm.domain.2.pageout_helper_threads_enabled=1 # Enable multi-threaded inactive queue scanning / see also vm.pageout_cpus_per_thread / def: 1
vm.domain.3.pageout_helper_threads_enabled=1 # Enable multi-threaded inactive queue scanning / see also vm.pageout_cpus_per_thread / def: 1
vm.swap_enabled=0			# Enable entire process swapout
vm.swap_idle_enabled=1			# Allow swapout on idle criteria / def: 0
vm.swap_idle_threshold1=4		# Guaranteed swapped in time for a process / def: 2
vm.swap_idle_threshold2=16		# Time before a process will be swapped out / def: 10
vm.disable_swapspace_pageouts=0		# Disallow swapout of dirty pages / def: 0
vm.kstack_cache_size=512		# Maximum number of cached kernel stacks