diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3cffaba --- /dev/null +++ b/debian/changelog @@ -0,0 +1,12 @@ +rakuos-settings (1.0.2-1-1rakuos8) unstable; urgency=medium + + * Adding default grub + * Porting things over from cachyos-settings + + -- Tohur Wed, 12 Nov 2025 23:22:44 -0700 + +rakuos-settings (1.0.1-2-1rakuos1) unstable; urgency=medium + + * Initial release of RakuOS settings package. + + -- Joshua Webb Thu, 06 Nov 2025 22:40:00 -0700 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..a98c7a6 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: rakuos-settings +Section: metapackages +Priority: optional +Maintainer: RakuOS Team +Build-Depends: debhelper-compat (= 13), +Standards-Version: 4.6.2 + +Package: rakuos-settings +Architecture: all +Replaces: systemd-zram-generator +Depends: ${misc:Depends}, systemd-zram-generator, libzstd1, rtkit +Description: Core OS config for RakuOS diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..5b4d8b3 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,10 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: RakuOS Branding +Upstream-Contact: Joshua Webb +Source: https://rakuos.org/ + +Files: * +Copyright: 2025 Joshua Webb +License: GPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License version 3 or later. diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..bb508f0 --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +etc/* etc/ +usr/* usr/ diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..ad27976 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +systemctl enable pci-latency.service diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..90f58ae --- /dev/null +++ b/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f +# Simple dh (debhelper) build rules file +%: + dh $@ + +override_dh_fixperms: + dh_fixperms + chmod 755 debian/rakuos-settings/usr/bin/kerver + chmod u+x debian/rakuos-settings/usr/bin/kerver + chmod 755 debian/rakuos-settings/usr/bin/pci-latency + chmod u+x debian/rakuos-settings/usr/bin/pci-latency + chmod 755 debian/rakuos-settings/usr/bin/topmem + chmod u+x debian/rakuos-settings/usr/bin/topmem + chmod 755 debian/rakuos-settings/usr/bin/zink-run + chmod u+x debian/rakuos-settings/usr/bin/zink-run diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/etc/apt/apt.conf.d/01rakuos b/etc/apt/apt.conf.d/01rakuos new file mode 100644 index 0000000..cc5e8ef --- /dev/null +++ b/etc/apt/apt.conf.d/01rakuos @@ -0,0 +1 @@ +APT::Default-Release "rakuos"; diff --git a/etc/apt/apt.conf.d/90update-grub b/etc/apt/apt.conf.d/90update-grub new file mode 100644 index 0000000..20a9b20 --- /dev/null +++ b/etc/apt/apt.conf.d/90update-grub @@ -0,0 +1,3 @@ +DPkg::Post-Invoke { + "if [ -x /usr/sbin/update-grub ]; then /usr/sbin/update-grub || true; fi"; +}; diff --git a/etc/security/limits.d/20-audio.conf b/etc/security/limits.d/20-audio.conf new file mode 100644 index 0000000..99d25b7 --- /dev/null +++ b/etc/security/limits.d/20-audio.conf @@ -0,0 +1 @@ +@audio - rtprio 99 diff --git a/usr/bin/kerver b/usr/bin/kerver new file mode 100755 index 0000000..96c6332 --- /dev/null +++ b/usr/bin/kerver @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +cat << EOF +Check kernel version: + +$(cat /proc/version && uname -a) + + +Check x86_64 support: + +$(/lib64/ld-linux-x86-64.so.2 --help | grep "(supported, searched)") + + +Check CPU config: + +$(zgrep -iE 'CONFIG_(GENERIC_CPU(=| is)|X86_64_VERSION|MZEN|MBULLDOZER|MPILEDRIVER|MSTREAMROLLER|MEXCAVATOR|MBOBCAT|MJAGUAR|MK10|MK8SSE3|MATOM|MGOLDMONTPLUS|MSKYLAKE2|MIVYBRIDGE|MICELAKE|MNATIVE_INTEL|MNATIVE_AMD|X86_NATIVE_CPU)' /proc/config.gz) + + +Current disk schedulers: + +$(for disk in /sys/block/*/ +do [ -f "$disk/queue/scheduler" ] \ + && echo "$(basename "$disk"): $(cat "$disk/queue/scheduler")" +done) + +Check available schedulers: + +$(journalctl --output cat -k | grep -i scheduler) +EOF diff --git a/usr/bin/pci-latency b/usr/bin/pci-latency new file mode 100755 index 0000000..06373c2 --- /dev/null +++ b/usr/bin/pci-latency @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +# This script is designed to improve the performance and reduce audio latency +# for sound cards by setting the PCI latency timer to an optimal value of 80 +# cycles. It also resets the default value of the latency timer for other PCI +# devices, which can help prevent devices with high default latency timers from +# causing gaps in sound. + +# Check if the script is run with root privileges +if [ "$(id -u)" -ne 0 ]; then + echo "Error: This script must be run with root privileges." >&2 + exit 1 +fi + +# Reset the latency timer for all PCI devices +setpci -v -s '*:*' latency_timer=20 +setpci -v -s '0:0' latency_timer=0 + +# Set latency timer for all sound cards +setpci -v -d "*:*:04xx" latency_timer=80 diff --git a/usr/bin/topmem b/usr/bin/topmem new file mode 100755 index 0000000..cd01cf7 --- /dev/null +++ b/usr/bin/topmem @@ -0,0 +1,219 @@ +#!/usr/bin/env lua +local f, concat, sort = string.format, table.concat, table.sort +local found, uv = pcall(require, 'luv') + +local function die(err, ...) + print(err:format(...)) + os.exit(1) +end + +if not found then + die("lua-luv dependency is missing, please install it from repositories") +end + +local function printf(pattern, ...) + print(pattern:format(...)) +end + +-- Patterns +local pid_pattern = "[0-9]+" +local ksm_profit_pattern = "ksm_process_profit%s*([0-9]+)" +local vm_rss_pattern = "VmRSS:%s*([0-9]+)" +local vm_swap_pattern = "VmSwap:%s*([0-9]+)" + +local function get_process_values(pid) + local path = concat({ "/proc", pid, "status" }, "/") + local file = io.open(path) + + if not file then + return nil + end + + local rss, swap + local line = file:read() + while line do + if rss == nil then + rss = line:match(vm_rss_pattern) + elseif swap == nil then + swap = line:match(vm_swap_pattern) + else + break + end + line = file:read() + end + file:close() + return tonumber(rss), tonumber(swap) +end + +local function get_process_ksm_profit(pid) + local file = io.open(concat({ "/proc", pid, "ksm_stat" }, "/")) + + if not file then + return 0 + end + + local stat = file:read("*a") + local profit = stat:match(ksm_profit_pattern) + + file:close() + + if not profit then + return 0 + end + + return tonumber(profit) +end + +local function get_process_first_arg(pid) + local file = io.open(concat({ "/proc", pid, "cmdline" }, "/")) + + if not file then + return nil + end + + local cmdline = file:read("*all") + file:close() + + return cmdline:match("([^%z]+)") +end + +local function convert_hashmap_table(map) + local new_hashmap = {} + for key, value in pairs(map) do + new_hashmap[#new_hashmap + 1] = { value[1], value[2], value[3], key } + end + + return new_hashmap +end + +local function get_process_map(sort_by) + local map = {} + local processes = uv.fs_scandir("/proc") + local pid, ftype = uv.fs_scandir_next(processes) + + while pid do + if pid:match(pid_pattern) then + if ftype == "directory" then + local rss, swap = get_process_values(pid) + local name = get_process_first_arg(pid) + local ksm_profit = get_process_ksm_profit(pid) + if name and rss then + if map[name] then + map[name][1] = map[name][1] + rss + map[name][2] = map[name][2] + swap + map[name][3] = map[name][3] + ksm_profit + else + map[name] = { rss, swap, ksm_profit } + end + end + end + end + pid, ftype = uv.fs_scandir_next(processes) + end + map = convert_hashmap_table(map) + sort(map, function(a, b) return (a[sort_by] > b[sort_by]) end) + return map +end + +local function truncate(str) + if #str > 25 then + return str:sub(1, 25) .. "..." + else + return str + end +end + +local function get_filename(path) + local lastSlash = path:find("/[^/]*$") + if lastSlash then + return path:sub(lastSlash + 1) + else + return path + end +end + +local function print_top(size, sort_by) + local map = get_process_map(sort_by) + printf("%-9s %35s %-9s %-s", "MEMORY", "Top " .. size .. " processes ", "SWAP", "KSM") + for i = 1, size do + local entry = map[i] + if entry then + printf( + "%-9s %-35s %-9s %-s", + f("%.0f", entry[1] / 1024) .. "M", + truncate(get_filename(entry[4])), + f("%.0f", entry[2] / 1024) .. "M", + f("%.0f", entry[3] / 1024 / 1024) .. "M" + ) + end + end +end + +local function print_help() + print([[ +Shows names of the top 10 (or N) processes by memory consumption + +Usage: topmem [OPTIONS] [N] + +Arguments: + [N] [default: 10] + +Options: + -s, --sort Column to sort by [possible values: rss (default), swap, ksm] + -h, --help Show this message]] +) + os.exit(0) +end + +local function main() + local sort_types = { + ["rss"] = 1, + ["swap"] = 2, + ["ksm"] = 3 + } + local sort_by = sort_types["rss"] + local size + local i = 1 + while i < #arg + 1 do + if arg[i] == "--sort" or arg[i] == "-s" or arg[i]:match("--sort=*") then + local criteria + local shift = true + + for value in string.gmatch(arg[i], "([^=]+)") do + if value ~= "--sort" and value ~= "-s" then + criteria = value + shift = false + break + end + end + + criteria = criteria or arg[i + 1] + if not criteria then + die("Column to sort by is not specified") + end + + if not sort_types[criteria] then + die("Wrong sorting criterion. Only available: rss, swap, ksm.") + else + sort_by = sort_types[criteria] + if shift then + i = i + 1 + end + end + elseif arg[i] == "--help" or arg[i] == "-h" then + print_help() + else + local status, value = pcall(tonumber, arg[i]) + if not status then + die("The argument must be a number") + else + size = value + end + end + i = i + 1 + end + + print_top(size or 10, sort_by) +end + +main() diff --git a/usr/bin/zink-run b/usr/bin/zink-run new file mode 100755 index 0000000..683a85e --- /dev/null +++ b/usr/bin/zink-run @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +export MESA_LOADER_DRIVER_OVERRIDE=zink +export GALLIUM_DRIVER=zink +export __GLX_VENDOR_LIBRARY_NAME=mesa +export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json +exec "$@" diff --git a/usr/lib/NetworkManager/conf.d/dns.conf b/usr/lib/NetworkManager/conf.d/dns.conf new file mode 100644 index 0000000..c81a643 --- /dev/null +++ b/usr/lib/NetworkManager/conf.d/dns.conf @@ -0,0 +1,2 @@ +[main] +dns=systemd-resolved diff --git a/usr/lib/modprobe.d/amdgpu.conf b/usr/lib/modprobe.d/amdgpu.conf new file mode 100644 index 0000000..55d5ab6 --- /dev/null +++ b/usr/lib/modprobe.d/amdgpu.conf @@ -0,0 +1,4 @@ +# Force using of the amdgpu driver for Southern Islands (GCN 1.0+) and Sea +# Islands (GCN 2.x) generations. +options amdgpu si_support=1 cik_support=1 +options radeon si_support=0 cik_support=0 diff --git a/usr/lib/modprobe.d/blacklist.conf b/usr/lib/modprobe.d/blacklist.conf new file mode 100644 index 0000000..3704059 --- /dev/null +++ b/usr/lib/modprobe.d/blacklist.conf @@ -0,0 +1,5 @@ +# Blacklist the Intel TCO Watchdog/Timer module +blacklist iTCO_wdt + +# Blacklist the AMD SP5100 TCO Watchdog/Timer module (Required for Ryzen cpus) +blacklist sp5100_tco diff --git a/usr/lib/modprobe.d/nvidia.conf b/usr/lib/modprobe.d/nvidia.conf new file mode 100644 index 0000000..7f7d715 --- /dev/null +++ b/usr/lib/modprobe.d/nvidia.conf @@ -0,0 +1,21 @@ +# +# NVreg_UsePageAttributeTable=1 (Default 0) - Activating the better memory +# management method (PAT). The PAT method creates a partition type table at a +# specific address mapped inside the register and utilizes the memory +# architecture and instruction set more efficiently and faster. If your system +# can support this feature, it should improve CPU performance. +# +# NVreg_InitializeSystemMemoryAllocations=0 (Default 1) - Disables clearing +# system memory allocation before using it for the GPU. Potentially improves +# performance, but at the cost of increased security risks. Write "options +# nvidia NVreg_InitializeSystemMemoryAllocations=1" in +# /etc/modprobe.d/nvidia.conf, if you want to return the default value. Note: +# It is possible to use more memory (?) +# +# NVreg_DynamicPowerManagement=0x02 - Enables the use of dynamic power +# management for Turing generation mobile cards, allowing the dGPU to be +# powered down during idle time. +# +options nvidia NVreg_UsePageAttributeTable=1 \ + NVreg_InitializeSystemMemoryAllocations=0 \ + NVreg_DynamicPowerManagement=0x02 diff --git a/usr/lib/modules-load.d/i2c-dev.conf b/usr/lib/modules-load.d/i2c-dev.conf new file mode 100755 index 0000000..fe0b6b5 --- /dev/null +++ b/usr/lib/modules-load.d/i2c-dev.conf @@ -0,0 +1,2 @@ +# Load i2c-dev.ko at boot +i2c-dev diff --git a/usr/lib/modules-load.d/i2c-piix4.conf b/usr/lib/modules-load.d/i2c-piix4.conf new file mode 100755 index 0000000..c271f25 --- /dev/null +++ b/usr/lib/modules-load.d/i2c-piix4.conf @@ -0,0 +1,2 @@ +# Load i2c-piix4.ko at boot +i2c-piix4 diff --git a/usr/lib/modules-load.d/ntsync.conf b/usr/lib/modules-load.d/ntsync.conf new file mode 100644 index 0000000..848573a --- /dev/null +++ b/usr/lib/modules-load.d/ntsync.conf @@ -0,0 +1 @@ +ntsync diff --git a/usr/lib/sysctl.d/99-bore-scheduler.conf b/usr/lib/sysctl.d/99-bore-scheduler.conf new file mode 100644 index 0000000..ed83281 --- /dev/null +++ b/usr/lib/sysctl.d/99-bore-scheduler.conf @@ -0,0 +1,26 @@ +### Use only if you want to change the default values! +### For more information look here: https://github.com/firelzrd/bore-scheduler#readme + +### Additional settings for BORE Scheduler (Work only if the BORE scheduler is enabled!) +### So make sure that kernel.sched_bore has a value of 1 + +# sched_burst_cache_lifetime (range: 0 - 4294967295, default: 75000000) +#kernel.sched_burst_cache_lifetime = 75000000 + +# sched_burst_fork_atavistic (range: 0 - 3, default: 2) +#kernel.sched_burst_fork_atavistic = 2 + +# sched_burst_penalty_offset (range: 0 - 64, default: 22) +#kernel.sched_burst_penalty_offset = 22 + +# sched_burst_penalty_scale (range: 0 - 4095, default: 1280) +#kernel.sched_burst_penalty_scale = 1280 + +# sched_burst_smoothness (range: 1 - 255, default: 20) +#kernel.sched_burst_smoothness = 20 + +# sched_burst_exclude_kthreads (range: 0 - 1, default: 1) +#kernel.sched_burst_exclude_kthreads = 1 + +# sched_burst_parity_threshold (range: u8, default: 2) +#kernel.sched_burst_parity_threshold = 2 diff --git a/usr/lib/sysctl.d/99-cachyos-settings.conf b/usr/lib/sysctl.d/99-cachyos-settings.conf new file mode 100644 index 0000000..369e8e1 --- /dev/null +++ b/usr/lib/sysctl.d/99-cachyos-settings.conf @@ -0,0 +1,49 @@ +# The sysctl swappiness parameter determines the kernel's preference for pushing anonymous pages or page cache to disk in memory-starved situations. +# A low value causes the kernel to prefer freeing up open files (page cache), a high value causes the kernel to try to use swap space, +# and a value of 100 means IO cost is assumed to be equal. +vm.swappiness = 100 + +# The value controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects (VFS cache). +# Lowering it from the default value of 100 makes the kernel less inclined to reclaim VFS cache (do not set it to 0, this may produce out-of-memory conditions) +vm.vfs_cache_pressure = 50 + +# Contains, as bytes, the number of pages at which a process which is +# generating disk writes will itself start writing out dirty data. +vm.dirty_bytes = 268435456 + +# page-cluster controls the number of pages up to which consecutive pages are read in from swap in a single attempt. +# This is the swap counterpart to page cache readahead. The mentioned consecutivity is not in terms of virtual/physical addresses, +# but consecutive on swap space - that means they were swapped out together. (Default is 3) +# increase this value to 1 or 2 if you are using physical swap (1 if ssd, 2 if hdd) +vm.page-cluster = 0 + +# Contains, as bytes, the number of pages at which the background kernel +# flusher threads will start writing out dirty data. +vm.dirty_background_bytes = 67108864 + +# The kernel flusher threads will periodically wake up and write old data out to disk. This +# tunable expresses the interval between those wakeups, in 100'ths of a second (Default is 500). +vm.dirty_writeback_centisecs = 1500 + +# This action will speed up your boot and shutdown, because one less module is loaded. Additionally disabling watchdog timers increases performance and lowers power consumption +# Disable NMI watchdog +kernel.nmi_watchdog = 0 + +# Enable the sysctl setting kernel.unprivileged_userns_clone to allow normal users to run unprivileged containers. +kernel.unprivileged_userns_clone = 1 + +# To hide any kernel messages from the console +kernel.printk = 3 3 3 3 + +# Restricting access to kernel pointers in the proc filesystem +kernel.kptr_restrict = 2 + +# Disable Kexec, which allows replacing the current running kernel. +kernel.kexec_load_disabled = 1 + +# Increase netdev receive queue +# May help prevent losing packets +net.core.netdev_max_backlog = 4096 + +# Set size of file handles and inode cache +fs.file-max = 2097152 diff --git a/usr/lib/systemd/journald.conf.d/00-journal-size.conf b/usr/lib/systemd/journald.conf.d/00-journal-size.conf new file mode 100644 index 0000000..b150f65 --- /dev/null +++ b/usr/lib/systemd/journald.conf.d/00-journal-size.conf @@ -0,0 +1,2 @@ +[Journal] +SystemMaxUse=50M diff --git a/usr/lib/systemd/system.conf.d/00-timeout.conf b/usr/lib/systemd/system.conf.d/00-timeout.conf new file mode 100644 index 0000000..120bfb8 --- /dev/null +++ b/usr/lib/systemd/system.conf.d/00-timeout.conf @@ -0,0 +1,3 @@ +[Manager] +DefaultTimeoutStartSec=15s +DefaultTimeoutStopSec=10s diff --git a/usr/lib/systemd/system.conf.d/10-limits.conf b/usr/lib/systemd/system.conf.d/10-limits.conf new file mode 100644 index 0000000..f6a2d32 --- /dev/null +++ b/usr/lib/systemd/system.conf.d/10-limits.conf @@ -0,0 +1,2 @@ +[Manager] +DefaultLimitNOFILE=2048:2097152 diff --git a/usr/lib/systemd/system/pci-latency.service b/usr/lib/systemd/system/pci-latency.service new file mode 100644 index 0000000..4ee9a33 --- /dev/null +++ b/usr/lib/systemd/system/pci-latency.service @@ -0,0 +1,9 @@ +[Unit] +Description=Adjust latency timers for PCI peripherals + +[Service] +Type=oneshot +ExecStart=/usr/bin/pci-latency + +[Install] +WantedBy=multi-user.target diff --git a/usr/lib/systemd/system/rtkit-daemon.service.d/override.conf b/usr/lib/systemd/system/rtkit-daemon.service.d/override.conf new file mode 100644 index 0000000..01e6116 --- /dev/null +++ b/usr/lib/systemd/system/rtkit-daemon.service.d/override.conf @@ -0,0 +1,2 @@ +[Service] +LogLevelMax=info diff --git a/usr/lib/systemd/system/user@.service.d/delegate.conf b/usr/lib/systemd/system/user@.service.d/delegate.conf new file mode 100644 index 0000000..ca8fc12 --- /dev/null +++ b/usr/lib/systemd/system/user@.service.d/delegate.conf @@ -0,0 +1,2 @@ +[Service] +Delegate=cpu cpuset io memory pids diff --git a/usr/lib/systemd/timesyncd.conf.d/10-timesyncd.conf b/usr/lib/systemd/timesyncd.conf.d/10-timesyncd.conf new file mode 100644 index 0000000..94472c2 --- /dev/null +++ b/usr/lib/systemd/timesyncd.conf.d/10-timesyncd.conf @@ -0,0 +1,8 @@ +[Time] +NTP=time.cloudflare.com +FallbackNTP=time.google.com 0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org +#RootDistanceMaxSec=5 +#PollIntervalMinSec=32 +#PollIntervalMaxSec=2048 +#ConnectionRetrySec=30 +#SaveIntervalSec=60 diff --git a/usr/lib/systemd/user.conf.d/10-limits.conf b/usr/lib/systemd/user.conf.d/10-limits.conf new file mode 100644 index 0000000..8f362eb --- /dev/null +++ b/usr/lib/systemd/user.conf.d/10-limits.conf @@ -0,0 +1,2 @@ +[Manager] +DefaultLimitNOFILE=1024:1048576 diff --git a/usr/lib/systemd/zram-generator.conf b/usr/lib/systemd/zram-generator.conf new file mode 100644 index 0000000..f802d84 --- /dev/null +++ b/usr/lib/systemd/zram-generator.conf @@ -0,0 +1,5 @@ +[zram0] +compression-algorithm = zstd +zram-size = ram +swap-priority = 100 +fs-type = swap diff --git a/usr/lib/tmpfiles.d/coredump.conf b/usr/lib/tmpfiles.d/coredump.conf new file mode 100644 index 0000000..d119952 --- /dev/null +++ b/usr/lib/tmpfiles.d/coredump.conf @@ -0,0 +1,2 @@ +# Clear all coredumps that were created more than 3 days ago +d /var/lib/systemd/coredump 0755 root root 3d diff --git a/usr/lib/tmpfiles.d/thp-shrinker.conf b/usr/lib/tmpfiles.d/thp-shrinker.conf new file mode 100644 index 0000000..bc216ea --- /dev/null +++ b/usr/lib/tmpfiles.d/thp-shrinker.conf @@ -0,0 +1,6 @@ +# THP Shrinker has been added in the 6.12 Kernel +# Default Value is 511 +# THP=always policy vastly overprovisions THPs in sparsely accessed memory areas, resulting in excessive memory pressure and premature OOM killing +# 409 means that any THP that has more than 409 out of 512 (80%) zero filled filled pages will be split. +# This reduces the memory usage, when THP=always used and the memory usage goes down to around the same usage as when madvise is used, while still providing an equal performance improvement +w! /sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_none - - - - 409 diff --git a/usr/lib/tmpfiles.d/thp.conf b/usr/lib/tmpfiles.d/thp.conf new file mode 100644 index 0000000..284a726 --- /dev/null +++ b/usr/lib/tmpfiles.d/thp.conf @@ -0,0 +1,3 @@ +# Improve performance for applications that use tcmalloc +# https://github.com/google/tcmalloc/blob/master/docs/tuning.md#system-level-optimizations +w! /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise diff --git a/usr/lib/udev/rules.d/20-audio-pm.rules b/usr/lib/udev/rules.d/20-audio-pm.rules new file mode 100644 index 0000000..cb856fd --- /dev/null +++ b/usr/lib/udev/rules.d/20-audio-pm.rules @@ -0,0 +1,17 @@ +# Disables power saving capabilities for snd-hda-intel when device is not +# running on battery power. This is needed because it prevents audio cracks on +# some hardware. +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="card*", DRIVERS=="snd_hda_intel", TEST!="/run/udev/snd-hda-intel-powersave", \ + RUN+="/usr/bin/bash -c 'touch /run/udev/snd-hda-intel-powersave; \ + [[ $$(cat /sys/class/power_supply/BAT0/status 2>/dev/null) != \"Discharging\" ]] && \ + echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave && \ + echo 0 > /sys/module/snd_hda_intel/parameters/power_save'" + +SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TEST=="/sys/module/snd_hda_intel", \ + RUN+="/usr/bin/bash -c 'echo $$(cat /run/udev/snd-hda-intel-powersave 2>/dev/null || \ + echo 10) > /sys/module/snd_hda_intel/parameters/power_save'" + +SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", TEST=="/sys/module/snd_hda_intel", \ + RUN+="/usr/bin/bash -c '[[ $$(cat /sys/module/snd_hda_intel/parameters/power_save) != 0 ]] && \ + echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave; \ + echo 0 > /sys/module/snd_hda_intel/parameters/power_save'" diff --git a/usr/lib/udev/rules.d/30-zram.rules b/usr/lib/udev/rules.d/30-zram.rules new file mode 100644 index 0000000..5d810c9 --- /dev/null +++ b/usr/lib/udev/rules.d/30-zram.rules @@ -0,0 +1,14 @@ +# When used with ZRAM, it is better to prefer page out only anonymous pages, +# because it ensures that they do not go out of memory, but will be just +# compressed. If we do frequent flushing of file pages, that increases the +# percentage of page cache misses, which in the long term gives additional +# cycles to re-read the same data from disk that was previously in page cache. +# This is the reason why it is recommended to use high values from 100 to keep +# the page cache as hermetic as possible, because otherwise it is "expensive" +# to read data from disk again. At the same time, uncompressing pages from ZRAM +# is not as expensive and is usually very fast on modern CPUs. +# +# Also it's better to disable Zswap, as this may prevent ZRAM from working +# properly or keeping a proper count of compressed pages via zramctl. +ACTION=="change", KERNEL=="zram0", ATTR{initstate}=="1", SYSCTL{vm.swappiness}="150", \ + RUN+="/bin/sh -c 'echo N > /sys/module/zswap/parameters/enabled'" diff --git a/usr/lib/udev/rules.d/40-hpet-permissions.rules b/usr/lib/udev/rules.d/40-hpet-permissions.rules new file mode 100644 index 0000000..7af3780 --- /dev/null +++ b/usr/lib/udev/rules.d/40-hpet-permissions.rules @@ -0,0 +1,2 @@ +KERNEL=="rtc0", GROUP="audio" +KERNEL=="hpet", GROUP="audio" diff --git a/usr/lib/udev/rules.d/50-sata.rules b/usr/lib/udev/rules.d/50-sata.rules new file mode 100644 index 0000000..ab5de96 --- /dev/null +++ b/usr/lib/udev/rules.d/50-sata.rules @@ -0,0 +1,4 @@ +# SATA Active Link Power Management +ACTION=="add", SUBSYSTEM=="scsi_host", KERNEL=="host*", \ + ATTR{link_power_management_policy}=="*", \ + ATTR{link_power_management_policy}="max_performance" diff --git a/usr/lib/udev/rules.d/60-ioschedulers.rules b/usr/lib/udev/rules.d/60-ioschedulers.rules new file mode 100644 index 0000000..7289a71 --- /dev/null +++ b/usr/lib/udev/rules.d/60-ioschedulers.rules @@ -0,0 +1,11 @@ +# HDD +ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="1", \ + ATTR{queue/scheduler}="bfq" + +# SSD +ACTION=="add|change", KERNEL=="sd[a-z]*|mmcblk[0-9]*", ATTR{queue/rotational}=="0", \ + ATTR{queue/scheduler}="mq-deadline" + +# NVMe SSD +ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/rotational}=="0", \ + ATTR{queue/scheduler}="none" diff --git a/usr/lib/udev/rules.d/69-hdparm.rules b/usr/lib/udev/rules.d/69-hdparm.rules new file mode 100644 index 0000000..2368b22 --- /dev/null +++ b/usr/lib/udev/rules.d/69-hdparm.rules @@ -0,0 +1,2 @@ +ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", \ + ATTRS{id/bus}=="ata", RUN+="/usr/bin/hdparm -B 254 -S 0 /dev/%k" diff --git a/usr/lib/udev/rules.d/71-nvidia.rules b/usr/lib/udev/rules.d/71-nvidia.rules new file mode 100644 index 0000000..e29bd6b --- /dev/null +++ b/usr/lib/udev/rules.d/71-nvidia.rules @@ -0,0 +1,9 @@ +# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind +ACTION=="add|bind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \ + ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \ + TEST=="power/control", ATTR{power/control}="auto" + +# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind +ACTION=="remove|unbind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \ + ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \ + TEST=="power/control", ATTR{power/control}="on" diff --git a/usr/lib/udev/rules.d/99-cpu-dma-latency.rules b/usr/lib/udev/rules.d/99-cpu-dma-latency.rules new file mode 100644 index 0000000..10d7727 --- /dev/null +++ b/usr/lib/udev/rules.d/99-cpu-dma-latency.rules @@ -0,0 +1 @@ +DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660" diff --git a/usr/share/X11/xorg.conf.d/20-touchpad.conf b/usr/share/X11/xorg.conf.d/20-touchpad.conf new file mode 100644 index 0000000..e69144d --- /dev/null +++ b/usr/share/X11/xorg.conf.d/20-touchpad.conf @@ -0,0 +1,7 @@ +Section "InputClass" + Identifier "libinput touchpad catchall" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + Driver "libinput" + Option "Tapping" "True" +EndSection