├── .github └── workflows │ └── yakt.yml ├── LICENSE ├── META-INF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script ├── README.md ├── build.sh ├── changelog.txt ├── customize.sh ├── module.prop ├── service.sh └── yakt.sh /.github/workflows/yakt.yml: -------------------------------------------------------------------------------- 1 | name: YAKT 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | 7 | workflow_dispatch: 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | container: 13 | image: z4nyx/docker:latest 14 | 15 | steps: 16 | - uses: actions/checkout@v2 17 | - name: yakt ToolChain Compile 18 | run: bash build.sh 19 | env: 20 | token: ${{ secrets.TOKEN }} 21 | chat_id: ${{ secrets.CHAT_ID }} 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 NotZeetaa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # echo before loading util_functions 10 | ui_print() { echo "$1"; } 11 | 12 | require_new_magisk() { 13 | ui_print "*******************************" 14 | ui_print " Please install Magisk v20.4+! " 15 | ui_print "*******************************" 16 | exit 1 17 | } 18 | 19 | ######################### 20 | # Load util_functions.sh 21 | ######################### 22 | 23 | OUTFD=$2 24 | ZIPFILE=$3 25 | 26 | mount /data 2>/dev/null 27 | 28 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 29 | . /data/adb/magisk/util_functions.sh 30 | [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk 31 | 32 | install_module 33 | exit 0 34 | -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![IMG_20220530_225120](https://user-images.githubusercontent.com/67799176/171062389-24c1c096-f991-449f-b962-45f145b95355.jpg) 2 | # YAKT 3 | **Yet Another Kernel Tweaker**. A Magisk module to Tweak your Kernel parameters. This module applies at boot and it's not an AI module. 4 | 5 | ## Features: 6 | ``` 7 | - Reduces Jitter and Latency 8 | - Optimizes Ram Management 9 | - Disables scheduler logs/stats 10 | - Disables printk logs 11 | - Disables SPI CRC 12 | - Tweaks mglru 13 | - Allows sched boosting on top-app tasks (Thx to tytydraco) 14 | - Tweaks uclamp scheduler (Credits to darkhz for uclamp tweak) 15 | - Sets -20 (highest priority) for the most essential processes 16 | - Uses Google's schedutil rate-limits from Pixel 3 17 | ``` 18 | ## Benchmark - As per v6 19 | 20 | | Benchmark | Stock | YAKT v6 | 21 | | --- | --- | --- | 22 | | Hackbench | 6.632 | 2.205 | 23 | | Callbench | syscall: 138 ns libc: 43 ns mmap: 11220 ns read: 5290 ns | syscall: 138 ns libc: 43 ns mmap: 11212 ns read: 4598 ns | 24 | 25 | ## Notes: 26 | - This is not a perfomance/gaming module 27 | 28 | ## How to flash: 29 | - Just flash in magisk and reboot 30 | - And that's it ;) 31 | 32 | ## How to check logs: 33 | - Check yakt.txt file in /data/adb/modules/YAKT/yakt.log folder 34 | - It should be like this (Not exactly ofc): 35 | 36 | ![Screenshot_20221105-133527_MT_Manager](https://user-images.githubusercontent.com/67799176/200122575-dc72aedb-3618-4172-8b81-27cbdc721247.png) 37 | 38 | ## How to Contribute: 39 | - Fork the Repo 40 | - Edit tweaks according to your info/docs 41 | - Commit with proper name and info/docs about what you did 42 | - Test the change you did and check if eveything it's fine 43 | - Then make a pull request 44 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | clog=$(/dev/null 6 | rm /sdcard/yakt.log 2>/dev/null 7 | rm /sdcard/yakt/yakt.txt 2>/dev/null 8 | rm "${MODPATH}/yakt.log" 2>/dev/null 9 | rm "${MODPATH}/yakt-logging-error.log" 2>/dev/null 10 | rm "${MODPATH}/LICENSE" 2>/dev/null 11 | rm "${MODPATH}/README.md" 2>/dev/null 12 | } 13 | SET_PERMISSION() { 14 | ui_print "- Setting Permissions" 15 | set_perm_recursive "$MODPATH" 0 0 0755 0644 16 | set_perm_recursive "${MODPATH}/yakt.sh" 0 0 0755 0700 17 | } 18 | MOD_EXTRACT() { 19 | ui_print "- Extracting Module Files" 20 | unzip -o "$ZIPFILE" yakt.sh -d "$MODPATH" >&2 21 | unzip -o "$ZIPFILE" service.sh -d "$MODPATH" >&2 22 | unzip -o "$ZIPFILE" module.prop -d "$MODPATH" >&2 23 | } 24 | MOD_PRINT() { 25 | ui_print "- YAKT" 26 | ui_print "- Installing" 27 | } 28 | set -x 29 | RM_RF 30 | MOD_PRINT 31 | MOD_EXTRACT 32 | SET_PERMISSION 33 | -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=YAKT 2 | name=Yet Another Kernel Tweaker 3 | version=v17 4 | versionCode=1 5 | author=NotZeetaa 6 | description=This modules tweaks your kernel parameters. -------------------------------------------------------------------------------- /service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | MODDIR=${0%/*} 3 | 4 | "${MODDIR}/yakt.sh" > /dev/null 5 | -------------------------------------------------------------------------------- /yakt.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # YAKT v17 3 | # Author: @NotZeetaa (Github) 4 | # ×××××××××××××××××××××××××× # 5 | 6 | sleep 30 7 | 8 | # Function to append a message to the specified log file 9 | log_message() { 10 | local log_file="$1" 11 | local message="$2" 12 | echo "[$(date "+%H:%M:%S")] $message" >> "$log_file" 13 | } 14 | 15 | # Function to log info messages 16 | log_info() { 17 | log_message "$INFO_LOG" "$1" 18 | } 19 | 20 | # Function to log error messages 21 | log_error() { 22 | log_message "$ERROR_LOG" "$1" 23 | } 24 | 25 | # Useful for debugging ig ¯\_(ツ)_/¯ 26 | # shellcheck disable=SC3033 27 | # log_debug() { 28 | # log_message "$DEBUG_LOG" "$1" 29 | # } 30 | 31 | # Function to write a value to a specified file 32 | write_value() { 33 | local file_path="$1" 34 | local value="$2" 35 | 36 | # Check if the file exists 37 | if [ ! -f "$file_path" ]; then 38 | log_error "Error: File $file_path does not exist." 39 | return 1 40 | fi 41 | 42 | # Make the file writable 43 | chmod +w "$file_path" 2>/dev/null 44 | 45 | # Write new value, log error if it fails 46 | if ! echo "$value" >"$file_path" 2>/dev/null; then 47 | log_error "Error: Failed to write to $file_path." 48 | return 1 49 | else 50 | return 0 51 | fi 52 | } 53 | 54 | MODDIR=${0%/*} # Get parent directory 55 | 56 | # Modify the filenames for logs 57 | INFO_LOG="${MODDIR}/info.log" 58 | ERROR_LOG="${MODDIR}/error.log" 59 | # DEBUG_LOG="${MODDIR}/debug.log" 60 | 61 | # Prepare log files 62 | :> "$INFO_LOG" 63 | :> "$ERROR_LOG" 64 | # :> "$DEBUG_LOG" 65 | 66 | # Variables 67 | UCLAMP_PATH="/dev/stune/top-app/uclamp.max" 68 | CPUSET_PATH="/dev/cpuset" 69 | MODULE_PATH="/sys/module" 70 | KERNEL_PATH="/proc/sys/kernel" 71 | IPV4_PATH="/proc/sys/net/ipv4" 72 | MEMORY_PATH="/proc/sys/vm" 73 | MGLRU_PATH="/sys/kernel/mm/lru_gen" 74 | SCHEDUTIL2_PATH="/sys/devices/system/cpu/cpufreq/schedutil" 75 | SCHEDUTIL_PATH="/sys/devices/system/cpu/cpu0/cpufreq/schedutil" 76 | ANDROID_VERSION=$(getprop ro.build.version.release) 77 | TOTAL_RAM=$(free -m | awk '/Mem/{print $2}') 78 | 79 | # Log starting information 80 | log_info "Starting YAKT v17" 81 | log_info "Build Date: 06/06/2024" 82 | log_info "Author: @NotZeetaa (Github)" 83 | log_info "Device: $(getprop ro.product.system.model)" 84 | log_info "Brand: $(getprop ro.product.system.brand)" 85 | log_info "Kernel: $(uname -r)" 86 | log_info "ROM Build Type: $(getprop ro.system.build.type)" 87 | log_info "Android Version: $ANDROID_VERSION" 88 | 89 | # Schedutil rate-limits tweak 90 | log_info "Applying schedutil rate-limits tweak" 91 | if [ -d "$SCHEDUTIL2_PATH" ]; then 92 | write_value "$SCHEDUTIL2_PATH/up_rate_limit_us" 10000 93 | write_value "$SCHEDUTIL2_PATH/down_rate_limit_us" 20000 94 | log_info "Applied schedutil rate-limits tweak" 95 | elif [ -e "$SCHEDUTIL_PATH" ]; then 96 | for cpu in /sys/devices/system/cpu/*/cpufreq/schedutil; do 97 | write_value "${cpu}/up_rate_limit_us" 10000 98 | write_value "${cpu}/down_rate_limit_us" 20000 99 | done 100 | log_info "Applied schedutil rate-limits tweak" 101 | else 102 | log_info "Abort: Not using schedutil governor" 103 | fi 104 | 105 | # Grouping tasks tweak 106 | log_info "Disabling Sched Auto Group..." 107 | write_value "$KERNEL_PATH/sched_autogroup_enabled" 0 108 | log_info "Done." 109 | 110 | # Enable CRF by default 111 | log_info "Enabling child_runs_first" 112 | write_value "$KERNEL_PATH/sched_child_runs_first" 1 113 | log_info "Done." 114 | 115 | # Apply RAM tweaks 116 | # The stat_interval reduces jitter (Credits to kdrag0n) 117 | # Credits to RedHat for dirty_ratio 118 | log_info "Applying RAM Tweaks" 119 | write_value "$MEMORY_PATH/vfs_cache_pressure" 50 120 | write_value "$MEMORY_PATH/stat_interval" 30 121 | write_value "$MEMORY_PATH/compaction_proactiveness" 0 122 | write_value "$MEMORY_PATH/page-cluster" 0 123 | log_info "Detecting if your device has less or more than 8GB of RAM" 124 | if [ $TOTAL_RAM -lt 8000 ]; then 125 | log_info "Detected 8GB or less" 126 | log_info "Applying appropriate tweaks..." 127 | write_value "$MEMORY_PATH/swappiness" 60 128 | else 129 | log_info "Detected more than 8GB" 130 | log_info "Applying appropriate tweaks..." 131 | write_value "$MEMORY_PATH/swappiness" 0 132 | fi 133 | write_value "$MEMORY_PATH/dirty_ratio" 60 134 | log_info "Applied RAM Tweaks" 135 | 136 | # Mglru tweaks 137 | # Credits to Arter97 138 | log_info "Checking if your kernel has MGLRU support..." 139 | if [ -d "$MGLRU_PATH" ]; then 140 | log_info "MGLRU support found." 141 | log_info "Tweaking MGLRU settings..." 142 | write_value "$MGLRU_PATH/min_ttl_ms" 5000 143 | log_info "Done." 144 | else 145 | log_info "MGLRU support not found." 146 | log_info "Aborting MGLRU tweaks..." 147 | fi 148 | 149 | # Set kernel.perf_cpu_time_max_percent to 10 150 | log_info "Setting perf_cpu_time_max_percent to 10" 151 | write_value "$KERNEL_PATH/perf_cpu_time_max_percent" 10 152 | log_info "Done." 153 | 154 | # Disable certain scheduler logs/stats 155 | # Also iostats & reduce latency 156 | # Credits to tytydraco 157 | log_info "Disabling some scheduler logs/stats" 158 | if [ -e "$KERNEL_PATH/sched_schedstats" ]; then 159 | write_value "$KERNEL_PATH/sched_schedstats" 0 160 | fi 161 | write_value "$KERNEL_PATH/printk" "0 0 0 0" 162 | write_value "$KERNEL_PATH/printk_devkmsg" "off" 163 | for queue in /sys/block/*/queue; do 164 | write_value "$queue/iostats" 0 165 | write_value "$queue/nr_requests" 64 166 | done 167 | log_info "Done." 168 | 169 | # Tweak scheduler to have less Latency 170 | # Credits to RedHat & tytydraco & KTweak 171 | log_info "Tweaking scheduler to reduce latency" 172 | write_value "$KERNEL_PATH/sched_migration_cost_ns" 50000 173 | write_value "$KERNEL_PATH/sched_min_granularity_ns" 1000000 174 | write_value "$KERNEL_PATH/sched_wakeup_granularity_ns" 1500000 175 | log_info "Done." 176 | 177 | # Disable Timer migration 178 | log_info "Disabling Timer Migration" 179 | write_value "$KERNEL_PATH/timer_migration" 0 180 | log_info "Done." 181 | 182 | # Cgroup tweak for UCLAMP scheduler 183 | if [ -e "$UCLAMP_PATH" ]; then 184 | # Uclamp tweaks 185 | # Credits to @darkhz 186 | log_info "UCLAMP scheduler detected, applying tweaks..." 187 | top_app="${CPUSET_PATH}/top-app" 188 | write_value "$top_app/uclamp.max" max 189 | write_value "$top_app/uclamp.min" 10 190 | write_value "$top_app/uclamp.boosted" 1 191 | write_value "$top_app/uclamp.latency_sensitive" 1 192 | foreground="${CPUSET_PATH}/foreground" 193 | write_value "$foreground/uclamp.max" 50 194 | write_value "$foreground/uclamp.min" 0 195 | write_value "$foreground/uclamp.boosted" 0 196 | write_value "$foreground/uclamp.latency_sensitive" 0 197 | background="${CPUSET_PATH}/background" 198 | write_value "$background/uclamp.max" max 199 | write_value "$background/uclamp.min" 20 200 | write_value "$background/uclamp.boosted" 0 201 | write_value "$background/uclamp.latency_sensitive" 0 202 | sys_bg="${CPUSET_PATH}/system-background" 203 | write_value "$sys_bg/uclamp.min" 0 204 | write_value "$sys_bg/uclamp.max" 40 205 | write_value "$sys_bg/uclamp.boosted" 0 206 | write_value "$sys_bg/uclamp.latency_sensitive" 0 207 | sysctl -w kernel.sched_util_clamp_min_rt_default=0 208 | sysctl -w kernel.sched_util_clamp_min=128 209 | log_info "Done." 210 | fi 211 | 212 | # Always allow sched boosting on top-app tasks 213 | # Credits to tytydraco 214 | log_info "Always allow sched boosting on top-app tasks" 215 | write_value "$KERNEL_PATH/sched_min_task_util_for_colocation" 0 216 | log_info "Done." 217 | 218 | # Disable SPI CRC if supported 219 | if [ -d "$MODULE_PATH/mmc_core" ]; then 220 | log_info "Disabling SPI CRC" 221 | write_value "$MODULE_PATH/mmc_core/parameters/use_spi_crc" 0 222 | log_info "Done." 223 | fi 224 | 225 | # Zswap tweaks 226 | log_info "Checking if your kernel supports zswap..." 227 | if [ -d "$MODULE_PATH/zswap" ]; then 228 | log_info "zswap supported, applying tweaks..." 229 | write_value "$MODULE_PATH/zswap/parameters/compressor" lz4 230 | log_info "Set zswap compressor to lz4 (fastest compressor)." 231 | write_value "$MODULE_PATH/zswap/parameters/zpool" zsmalloc 232 | log_info "Set zpool to zsmalloc." 233 | log_info "Tweaks applied." 234 | else 235 | log_info "Your kernel doesn't support zswap, aborting it..." 236 | fi 237 | 238 | # Enable power efficiency 239 | log_info "Enabling power efficiency..." 240 | write_value "$MODULE_PATH/workqueue/parameters/power_efficient" 1 241 | log_info "Done." 242 | 243 | # Disable TCP timestamps for reduced overhead 244 | log_info "Disabling TCP timestamps..." 245 | write_value "$IPV4_PATH/tcp_timestamps" 0 246 | log_info "Done." 247 | 248 | # Enable TCP low latency mode 249 | log_info "Enabling TCP low latency mode..." 250 | write_value "$IPV4_PATH/tcp_low_latency" 1 251 | log_info "Done." 252 | 253 | log_info "Tweaks applied successfully. Enjoy :)" 254 | --------------------------------------------------------------------------------