Re: optimize pagedaemon settings

Mark Millard <[email protected]> Thu, 4 Jun 2026 10:09:09 -0700
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
On 6/4/26 09:00, Mark Johnston wrote:
> On Wed, Jun 03, 2026 at 02:33:00AM +0300, Rozhuk Ivan wrote:
>> 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
> 
> Is there no swap configured on this system?  If not, then the pagedaemon
> cannot reclaim those laundry pages.

I'll add some words to that: laundry pages are dirty, meaning they have
no alternate copy to restore for later use but contain information that
has not been freed. Just freeing those pages would destroy that
information. By contrast, paging laundry pages to the swap space first
allows restoring the content later after the free by paging back what
was saved.

In other words: laundry is basically pages that have been fully
classified and prepared for potential paging out to a swap space.

Absent the swap space having been configured for operation, the page
stays in RAM to avoid a loss of information. (That also happens when the
swap space is fully used already.)

> 
>>   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
>>
>>
>>
> 
> 


-- 
===
Mark Millard
marklmi at yahoo.com