If you are looking to control your CPU speed/power, there are some posting on that topic, of which I offer one, the following my myself:
A discussion on various "tweaks" to clamp down on security:
If you are looking to "optimize" performance for your personal context, the system's tunable parameters are controlled by specifying values in the file
/etc/sysctl.conf
The more notable parameters are, grouped according to my sense of likely benefits and ease of tuning (in descending order), would be:
vm.swappiness
vm.dirty_background_ratio
vm.dirty_ratio
vm.dirty_expire_centisecs
vm.dirtytime_expire_seconds
vm.dirty_writeback_centisecs
vm.vfs_cache_pressure
vm.watermark_scale_factor
vm.watermark_boost_factor
vm.overcommit_memory
vm.overcommit_ratio
vm.overcommit_kbytes
FAIR WARNING:
-
Tread carefully! Make no changes until you have studied and reviewed what others have done in terms of modifying the parameters, and the observed changes in system behaviour.
-
I myself have not been able to dedicate as much time as I need to properly study and tune the Kernel parameters, so I am NOT in a position to make any kind of recommendations.
Others in the Community, who feel they have sufficiently mastered those for their own needs, may be able to offer some solid initial recommendations on parameter tweaks.
DO NOT USE THE FOLLOWING BLINDLY !!!
I include my additions/changes to the sysctl.conf
file for reference only, because I have used the file as my living document with references to useful URLs and significant observations or intents for future investigation.
The following is NOT to be considered a guidepost, but a resource for consideration and stepping stone to further research on your own part to determine what would best suit your own context.
Addenda to "sysctl.conf":
(Linux OasisMega1 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC)
("lsb_release -a" reports Ubuntu 22.04.5 LTS)
###################################################################
# Location of kernel files: /proc/sys/vm
#
#
###################################################################
# LOCAL CUSTOM KERNEL SETTINGS (System Defaults unless otherwise noted
#
###################################################################
### FUZZY: BENEFIT or NEED for control
### FUZZY: RATIONALE and LOGIC for tuning
###################################################################
# REF: https://yarchive.net/comp/linux/dirty_limits.html
# low values increase frequency of pdflush
# was 10 ; leave bytes at 0
# PREVIOUS: 4
vm.dirty_background_ratio = 2
# not valid on older kernels [UbuntuMATE 22.04]
#vm.dirty_background_bytes = 0
# REF: https://yarchive.net/comp/linux/dirty_limits.html
# was 20 ; leave bytes at 0
# PREVIOUS: 12
vm.dirty_ratio = 30
# not valid on older kernels [UbuntuMATE 22.04]
#vm.dirty_bytes = 0
# REF: https://bbs.archlinux.org/viewtopic.php?id=271192
# REF: https://forum.garudalinux.org/t/swappiness-defaults/8634/8
# REF: https://rudd-o.com/en/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that
# REF: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
# was 60
# PREVIOUS: 20
vm.swappiness = 10
# *** was 3000
vm.dirty_expire_centisecs = 1000
# was 43200
# PREVIOUS: 20000
vm.dirtytime_expire_seconds = 10000
# *** was 500
# PREVIOUS: 100
vm.dirty_writeback_centisecs = 200
# REF: https://serverfault.com/questions/606185/how-does-vm-overcommit-memory-work
# was 0
# STATUS: FROZEN
vm.overcommit_memory = 0
# REF: https://unix.stackexchange.com/questions/348415/overcommit-memory-and-overcommit-ratio
# REF: https://stackoverflow.com/questions/42527334/what-is-the-vm-overcommit-ratio-in-linux
# was 50 ; leave bytes at 0
# PREVIOUS: 25
vm.overcommit_ratio = 15
vm.overcommit_kbytes = 0
# REF: https://rudd-o.com/en/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that
# prefer inode/dentry cache to other caches by lowering value
# was 100
# STATUS: PROBATION
vm.vfs_cache_pressure = 50
# REF: https://www.kernel.org/doc/html/v5.10/admin-guide/sysctl/vm.html
# was 3 ; leave unfairness at 5
vm.page-cluster = 4
vm.page_lock_unfairness = 5
# REF: https://www.kernel.org/doc/html/v5.10/admin-guide/sysctl/vm.html
# REF: https://dri.freedesktop.org/docs/drm/admin-guide/sysctl/vm.html
# was 0 (minimum is 8)
vm.percpu_pagelist_high_fraction = 0
# REF: https://www.kernel.org/doc/html/v5.10/admin-guide/sysctl/vm.html
# was 10 (maximum is 1000; ) ; leave boost at 15000
# REF: https://www.antixforum.com/forums/topic/how-to-get-rid-of-freezes-on-low-ram-pcs/
# was 20
vm.watermark_scale_factor = 1000
vm.watermark_boost_factor = 15000
# REF: https://www.kernel.org/doc/html/v5.10/admin-guide/sysctl/vm.html
# was 500 (minimum 0; maximum 1000)
vm.extfrag_threshold = 500
###################################################################
### UNKNOWN: BENEFIT or NEED for control
### UNKNOWN: RATIONALE and LOGIC for tuning
###################################################################
vm.min_free_kbytes = 67584
#vm.min_slab_ratio = 5
#vm.min_unmapped_ratio = 1
vm.admin_reserve_kbytes = 8192
vm.mmap_min_addr = 65536
#vm.mmap_rnd_bits = 28
#vm.mmap_rnd_compat_bits = 8
vm.user_reserve_kbytes = 90551
vm.zone_reclaim_mode = 0
###################################################################
### UNKNOWN: BENEFIT or NEED for control
### UNKNOWN: RATIONALE and LOGIC for tuning
###################################################################
vm.laptop_mode = 0
#vm.compaction_proactiveness = 20
#vm.compact_unevictable_allowed = 1
#vm.hugetlb_shm_group = 0
#vm.legacy_va_layout = 0
#vm.lowmem_reserve_ratio = 256 256 32 0 0
#vm.max_map_count = 65530
#vm.memory_failure_early_kill = 0
#vm.memory_failure_recovery = 1
#vm.nr_hugepages = 0
#vm.nr_hugepages_mempolicy = 0
#vm.nr_overcommit_hugepages = 0
#vm.numa_stat = 1
#vm.numa_zonelist_order = Node
#vm.oom_dump_tasks = 1
#vm.oom_kill_allocating_task = 0
#vm.panic_on_oom = 0
#vm.stat_interval = 1
#vm.unprivileged_userfaultfd = 0