From 8e66a6e0bd4ae155191603f4e52b14806d160de7 Mon Sep 17 00:00:00 2001 From: Valeria Fadeeva Date: Fri, 11 Jul 2025 23:12:38 +0500 Subject: [PATCH] Init --- README.md | 30 +++ etc/debuginfod/cachyos.urls | 1 + push.sh | 5 + usr/bin/cachyos-bugreport.sh | 119 ++++++++++ usr/bin/dlss-swapper | 13 ++ usr/bin/dlss-swapper-dll | 12 + usr/bin/game-performance | 20 ++ usr/bin/kerver | 29 +++ usr/bin/paste-cachyos | 15 ++ usr/bin/pci-latency | 19 ++ usr/bin/sbctl-batch-sign | 29 +++ usr/bin/topmem | 219 ++++++++++++++++++ usr/bin/zink-run | 6 + usr/lib/modprobe.d/20-audio-pm.conf | 5 + usr/lib/modprobe.d/amdgpu.conf | 4 + usr/lib/modprobe.d/blacklist.conf | 5 + usr/lib/modprobe.d/nvidia.conf | 36 +++ usr/lib/modules-load.d/ntsync.conf | 1 + usr/lib/sysctl.d/99-bore-scheduler.conf | 26 +++ usr/lib/sysctl.d/99-cachyos-settings.conf | 49 ++++ .../journald.conf.d/00-journal-size.conf | 2 + usr/lib/systemd/system.conf.d/00-timeout.conf | 3 + usr/lib/systemd/system.conf.d/limits.conf | 2 + usr/lib/systemd/system/pci-latency.service | 9 + .../rtkit-daemon.service.d/override.conf | 2 + .../system/user@.service.d/delegate.conf | 2 + .../systemd/timesyncd.conf.d/timesyncd.conf | 8 + usr/lib/systemd/user.conf.d/limits.conf | 2 + usr/lib/systemd/zram-generator.conf | 5 + usr/lib/tmpfiles.d/coredump.conf | 2 + usr/lib/tmpfiles.d/thp-shrinker.conf | 6 + usr/lib/tmpfiles.d/thp.conf | 3 + usr/lib/udev/rules.d/20-audio-pm.rules | 11 + usr/lib/udev/rules.d/30-zram.rules | 14 ++ .../udev/rules.d/40-hpet-permissions.rules | 2 + usr/lib/udev/rules.d/50-sata.rules | 4 + usr/lib/udev/rules.d/60-ioschedulers.rules | 11 + usr/lib/udev/rules.d/69-hdparm.rules | 2 + usr/lib/udev/rules.d/71-nvidia.rules | 9 + usr/lib/udev/rules.d/99-cpu-dma-latency.rules | 1 + usr/share/X11/xorg.conf.d/20-touchpad.conf | 7 + ...awy.ru.gnome.login-screen.gschema.override | 2 + 42 files changed, 752 insertions(+) create mode 100644 README.md create mode 100644 etc/debuginfod/cachyos.urls create mode 100755 push.sh create mode 100755 usr/bin/cachyos-bugreport.sh create mode 100755 usr/bin/dlss-swapper create mode 100755 usr/bin/dlss-swapper-dll create mode 100755 usr/bin/game-performance create mode 100755 usr/bin/kerver create mode 100755 usr/bin/paste-cachyos create mode 100755 usr/bin/pci-latency create mode 100755 usr/bin/sbctl-batch-sign create mode 100755 usr/bin/topmem create mode 100755 usr/bin/zink-run create mode 100644 usr/lib/modprobe.d/20-audio-pm.conf create mode 100644 usr/lib/modprobe.d/amdgpu.conf create mode 100644 usr/lib/modprobe.d/blacklist.conf create mode 100644 usr/lib/modprobe.d/nvidia.conf create mode 100644 usr/lib/modules-load.d/ntsync.conf create mode 100644 usr/lib/sysctl.d/99-bore-scheduler.conf create mode 100644 usr/lib/sysctl.d/99-cachyos-settings.conf create mode 100644 usr/lib/systemd/journald.conf.d/00-journal-size.conf create mode 100644 usr/lib/systemd/system.conf.d/00-timeout.conf create mode 100644 usr/lib/systemd/system.conf.d/limits.conf create mode 100644 usr/lib/systemd/system/pci-latency.service create mode 100644 usr/lib/systemd/system/rtkit-daemon.service.d/override.conf create mode 100644 usr/lib/systemd/system/user@.service.d/delegate.conf create mode 100644 usr/lib/systemd/timesyncd.conf.d/timesyncd.conf create mode 100644 usr/lib/systemd/user.conf.d/limits.conf create mode 100644 usr/lib/systemd/zram-generator.conf create mode 100644 usr/lib/tmpfiles.d/coredump.conf create mode 100644 usr/lib/tmpfiles.d/thp-shrinker.conf create mode 100644 usr/lib/tmpfiles.d/thp.conf create mode 100644 usr/lib/udev/rules.d/20-audio-pm.rules create mode 100644 usr/lib/udev/rules.d/30-zram.rules create mode 100644 usr/lib/udev/rules.d/40-hpet-permissions.rules create mode 100644 usr/lib/udev/rules.d/50-sata.rules create mode 100644 usr/lib/udev/rules.d/60-ioschedulers.rules create mode 100644 usr/lib/udev/rules.d/69-hdparm.rules create mode 100644 usr/lib/udev/rules.d/71-nvidia.rules create mode 100644 usr/lib/udev/rules.d/99-cpu-dma-latency.rules create mode 100644 usr/share/X11/xorg.conf.d/20-touchpad.conf create mode 100644 usr/share/glib-2.0/schemas/zz_melawy.ru.gnome.login-screen.gschema.override diff --git a/README.md b/README.md new file mode 100644 index 0000000..297deec --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# CachyOS-Settings +Configuration files that tweak sysctl values, add udev rules to automatically set schedulers, and provide additional optimizations. + +[CachyOS-Settings](https://github.com/CachyOS/CachyOS-Settings) + +## udev rules +- Audio latency +- SATA Active Link Power Management for HDD to prioritize max performance +- IO schedulers, automatic selection schedulers depends on your HW - SATA SSD, NVME and HDD. +- NVIDIA, load, unload modules and set-up power management. + +## sysctl +- Tweaks focused to memory and network. + +## modprobe +- NVIDIA and enable direct rendering +- Force using of the amdgpu driver for Southern Islands (GCN 1.0+) and Sea Islands (GCN 2.0+). + +## systemd +- PCI latency +- Journal Size reduced to 50MB +- KSM inheritated via system +- Timesync config for time.google.com +- Zram Generator config + +## Scripts +- Easily switch between amdpstate-epp and amdpstate-guided +- Upload logs with paste-cachyos, for example: sudo dmesg | paste-cachyos +- View up to 10 process memory/swap usage (topmem) +- Run OpenGL programs with the Zink Gallium driver using the zink-run wrapper diff --git a/etc/debuginfod/cachyos.urls b/etc/debuginfod/cachyos.urls new file mode 100644 index 0000000..340cbb0 --- /dev/null +++ b/etc/debuginfod/cachyos.urls @@ -0,0 +1 @@ +https://debuginfod.cachyos.org diff --git a/push.sh b/push.sh new file mode 100755 index 0000000..345883e --- /dev/null +++ b/push.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +git add . && git commit -m "Update" && git push + +echo "Ready" diff --git a/usr/bin/cachyos-bugreport.sh b/usr/bin/cachyos-bugreport.sh new file mode 100755 index 0000000..8e73763 --- /dev/null +++ b/usr/bin/cachyos-bugreport.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +# CachyOS bug reporting shell script. This shell +# script will generate a log file named "cachyos-bug-report.log". + +LOG_FILENAME="${LOG_FILENAME:-"cachyos-bugreport.log"}" +OLD_LOG_FILENAME=cachyos-bugreport.log.old + +ask_yes_no(){ + local question="${1}" + while ! printf '%s' "${answer}" | grep -q '^\([Yy]\(es\)\?\|[Nn]\(o\)\?\)$'; do + printf '%s' "${question} [Y]es/[N]o: " + read -r answer + done + + if printf '%s' "${answer}" | grep -q '^[Nn]\(o\)\?$'; then + return 1 + fi +} + +check_root(){ + # Check that we are root, required for dmesg + if [ "$(id -u)" -ne 0 ]; then + echo "ERROR: Please run $(basename "$0") as root." >&2 + exit 1 + fi +} + + +# move any old log file +check_oldlog() { + if [ -f "$LOG_FILENAME" ]; then + mv "$LOG_FILENAME" "$OLD_LOG_FILENAME" + fi +} + + +check_wpermission() { + if ! touch "$LOG_FILENAME" 2>/dev/null; then + cat << EOF >&2 + +ERROR: Working directory is not writable; please cd to a directory + where you have write permission so that the $LOG_FILENAME + file can be written. + +EOF + exit 1 + fi +} + +get_installed_packages() { + if [ -e /var/lib/pacman/sync/cachyos-v4.db ]; then + pacman -Ss | grep --color=never "^cachyos-v4/.*\[installed\]" + elif [ -e /var/lib/pacman/sync/cachyos-v3.db ]; then + pacman -Ss | grep --color=never "^cachyos-v3/.*\[installed\]" + elif [ -e /var/lib/pacman/sync/cachyos-znver4.db ]; then + pacman -Ss | grep --color=never "^cachyos-znver4/.*\[installed\]" + else + echo "znver4, v4 or v3 repositories are not used" + fi +} + +bugreport() { + echo "Starting with bugreport" + + cat << EOF >"$LOG_FILENAME" +____________________________________________ + +Start of CachyOS bug report log file. Please send this report, +along with a description of your bug, to CachyOS. + +Date: $(date) +uname: $(uname -a) + +____________________________________________ +Getting Hardware Information + +$(inxi -F) +____________________________________________ +Getting Scheduler information + +sched-ext: +$(grep -R "" /sys/kernel/sched_ext/) + +$(journalctl --output cat -k | grep -i scheduler) + +____________________________________________ + +dmesg + +$(dmesg) + +____________________________________________ +journalctl of current boot + +$(journalctl -b -p 4..1) +____________________________________________ + +Installed packages + +$(get_installed_packages) +-------------------------------------------- +EOF +} + +upload() { + if ask_yes_no 'Do you want to upload this log to https://paste.cachyos.org?'; then + echo "Uploading Log" + paste-cachyos "$LOG_FILENAME" + else + echo "Not uploading Log" + fi + +} + +check_root +check_oldlog +check_wpermission +bugreport +upload diff --git a/usr/bin/dlss-swapper b/usr/bin/dlss-swapper new file mode 100755 index 0000000..84339aa --- /dev/null +++ b/usr/bin/dlss-swapper @@ -0,0 +1,13 @@ +#!/usr/bin/bash + +# This forces Nvidia DLSS to use the latest preset for SR, RR and framegen + updates the dlss dlls via ngx + +export PROTON_ENABLE_NGX_UPDATER=1 +export DXVK_NVAPI_DRS_NGX_DLSS_RR_OVERRIDE=on +export DXVK_NVAPI_DRS_NGX_DLSS_SR_OVERRIDE=on +export DXVK_NVAPI_DRS_NGX_DLSS_FG_OVERRIDE=on +export DXVK_NVAPI_DRS_NGX_DLSS_RR_OVERRIDE_RENDER_PRESET_SELECTION=render_preset_latest +export DXVK_NVAPI_DRS_NGX_DLSS_SR_OVERRIDE_RENDER_PRESET_SELECTION=render_preset_latest + +# applied variables, now execute the rest of the command +exec "$@" diff --git a/usr/bin/dlss-swapper-dll b/usr/bin/dlss-swapper-dll new file mode 100755 index 0000000..7cd4de0 --- /dev/null +++ b/usr/bin/dlss-swapper-dll @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +# This forces Nvidia DLSS to use the latest preset for SR, RR and framegen + skips ngx updater + +export DXVK_NVAPI_DRS_NGX_DLSS_RR_OVERRIDE=on +export DXVK_NVAPI_DRS_NGX_DLSS_SR_OVERRIDE=on +export DXVK_NVAPI_DRS_NGX_DLSS_FG_OVERRIDE=on +export DXVK_NVAPI_DRS_NGX_DLSS_RR_OVERRIDE_RENDER_PRESET_SELECTION=render_preset_latest +export DXVK_NVAPI_DRS_NGX_DLSS_SR_OVERRIDE_RENDER_PRESET_SELECTION=render_preset_latest + +# applied variables, now execute the rest of the command +exec "$@" diff --git a/usr/bin/game-performance b/usr/bin/game-performance new file mode 100755 index 0000000..9156b93 --- /dev/null +++ b/usr/bin/game-performance @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Helper script to enable the performance gov with proton or others +if ! command -v powerprofilesctl &>/dev/null; then + echo "Error: powerprofilesctl not found" >&2 + exit 1 +fi + +# Don't fail if the CPU driver doesn't support performance power profile +if ! powerprofilesctl list | grep -q 'performance:'; then + exec "$@" +fi + +# Set performance governors, as long the game is launched +if [ -n "$GAME_PERFORMANCE_SCREENSAVER_ON" ]; then + exec powerprofilesctl launch -p performance \ + -r "Launched with CachyOS game-performance utility" -- "$@" +else + exec systemd-inhibit --why "CachyOS game-performance is running" powerprofilesctl launch \ + -p performance -r "Launched with CachyOS game-performance utility" -- "$@" +fi 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/paste-cachyos b/usr/bin/paste-cachyos new file mode 100755 index 0000000..460b6df --- /dev/null +++ b/usr/bin/paste-cachyos @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Change the url accordingly +URL="https://paste.cachyos.org" + +FILEPATH="$1" +FILENAME="$(basename -- "$FILEPATH")" +EXTENSION="${FILENAME##*.}" + +RESPONSE="$(curl --data-binary @"${FILEPATH:-/dev/stdin}" --url $URL)" +PASTELINK="${URL}${RESPONSE}" + +[ -z "$EXTENSION" ] && \ + echo "$PASTELINK" || \ + echo "${PASTELINK}.${EXTENSION}" 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/sbctl-batch-sign b/usr/bin/sbctl-batch-sign new file mode 100755 index 0000000..9c45fe5 --- /dev/null +++ b/usr/bin/sbctl-batch-sign @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# sbctl-batch-sign is a helper script designed to make it easier for users to sign files needed for secure boot support. +# The obvious case in which this script helps a lot is when dual booting Windows as there are a lot of files by Windows that +# needs to be signed in EFI. +set -e + +if [ -f /boot/limine.conf ]; then + echo "Limine detected, please do not use this script." + exit 0 +fi + +if [ "$(id -u)" -ne 0 ]; then + echo "Error: This script must be run with root privileges." + exit 1 +fi + +export ESP_PATH=/boot +sbctl verify 2>/dev/null | awk '/✗/ {print $2}' | while IFS= read -r entry; do + # We expect users who use this script to enroll their + # own keys alongside Microsoft's. + # With that in mind, there's no need to sign MS ESP + # files with our own keys. + if [[ "$entry" =~ ^.*/EFI/(Microsoft|Windows) || "$entry" == *.mui || "$entry" == *.dll + || "$entry" =~ ^/boot/grub ]]; then + continue + fi + sbctl sign -s "$entry" +done 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/modprobe.d/20-audio-pm.conf b/usr/lib/modprobe.d/20-audio-pm.conf new file mode 100644 index 0000000..1a0d1b9 --- /dev/null +++ b/usr/lib/modprobe.d/20-audio-pm.conf @@ -0,0 +1,5 @@ +# 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. If device starts working on battery power, same named udev rule +# re-enables power saving. +options snd_hda_intel power_save=0 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..66d37f6 --- /dev/null +++ b/usr/lib/modprobe.d/nvidia.conf @@ -0,0 +1,36 @@ +# +# 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. +# +# NVreg_RegistryDwords=RMIntrLockingMode=1 (default 0) - enables experimental +# switch for better frame-pacing this mainly improves it for high refresh rate +# monitors with VRR or VR headsets. +# +# Note: This only works for PRIME configurations if your dGPU is controlling an +# external monitor. +# +# For example: At 240Hz each frame is expected every 4ms. But if a 1ms +# task—say, in the kernel or on the GSP — runs when a frame is about to be +# displayed, it can delay the rendering. Instead of a neat sequence at T+4ms, +# T+8ms, T+12ms, the frames might appear at T+4ms, T+9ms, T+12ms, etc. This +# shows how even small delays can shift frame timing, potentially impacting +# smooth display output. +# +options nvidia NVreg_UsePageAttributeTable=1 \ + NVreg_InitializeSystemMemoryAllocations=0 \ + NVreg_DynamicPowerManagement=0x02 \ + NVreg_RegistryDwords=RMIntrLockingMode=1 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..2dca888 --- /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: 60000000) +#kernel.sched_burst_cache_lifetime = 60000000 + +# 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_long (range: 0 - 1, default: 1) +#kernel.sched_burst_smoothness_long = 1 + +# sched_burst_smoothness_short (range: 0 - 1, default: 0) +#kernel.sched_burst_smoothness_short = 0 + +# sched_burst_exclude_kthreads (range: 0 - 1, default: 1) +#kernel.sched_burst_exclude_kthreads = 1 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/limits.conf b/usr/lib/systemd/system.conf.d/limits.conf new file mode 100644 index 0000000..f6a2d32 --- /dev/null +++ b/usr/lib/systemd/system.conf.d/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/timesyncd.conf b/usr/lib/systemd/timesyncd.conf.d/timesyncd.conf new file mode 100644 index 0000000..94472c2 --- /dev/null +++ b/usr/lib/systemd/timesyncd.conf.d/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/limits.conf b/usr/lib/systemd/user.conf.d/limits.conf new file mode 100644 index 0000000..8f362eb --- /dev/null +++ b/usr/lib/systemd/user.conf.d/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..dedc9f2 --- /dev/null +++ b/usr/lib/systemd/zram-generator.conf @@ -0,0 +1,5 @@ +[zram0] +compression-algorithm = zstd lz4 (type=huge) +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..6ff6c8f --- /dev/null +++ b/usr/lib/udev/rules.d/20-audio-pm.rules @@ -0,0 +1,11 @@ +# 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. +SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TEST=="/sys/module/snd_hda_intel", \ + RUN+="/bin/sh -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+="/bin/sh -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..4f3f7de --- /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", \ + 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 diff --git a/usr/share/glib-2.0/schemas/zz_melawy.ru.gnome.login-screen.gschema.override b/usr/share/glib-2.0/schemas/zz_melawy.ru.gnome.login-screen.gschema.override new file mode 100644 index 0000000..c11c6c8 --- /dev/null +++ b/usr/share/glib-2.0/schemas/zz_melawy.ru.gnome.login-screen.gschema.override @@ -0,0 +1,2 @@ +[org.gnome.login-screen] +logo='/usr/share/pixmaps/melawy-linux.svg'