LightBlog

samedi 22 août 2020

KTweak is a new kernel adjustment mod that optimizes the performance of Android devices

Here at XDA, we love to keep tabs on kernel source code release events by various Android OEMs. The modus operandi of this practice lies in the fact that our brilliant aftermarket development community often tinkers with those stock kernel sources to fix existing bugs or even add some kind of novel feature. The concept of the Generic Kernel Image (GKI) is still as mature as the Generic System Image (GSI), which is why such device-specific custom kernels are the preferred method to manipulate low-level hardware parameters in the Android ecosystem.

As a matter of fact, the Linux kernel itself exposes a number of tunable parameters through pseudo file systems like sysfs and procfs. If you ever use a “kernel manager” app for tweaking the kernel of your Android device, you are basically playing with a nice frontend of sysfs (or procfs, depending on the parameter). Based on this aspect of Android kernels, XDA Recognized Developer tytydraco has come up with a unique Magisk Module named KTweak that can serve as a universal kernel tweaker.

According to the developer, Android kernels are usually compiled with CONFIG_SCHED_DEBUG as well as other debugging options set to true, which are enough to tune the kernel parameters on the fly given that you have root access. Google will eventually bring Generic Kernel Image to the masses, thus it indeed seems feasible to switch to a device-agnostic solution in the long run instead of recompiling device-specific kernel sources from scratch to achieve the same result.

Unlike some popular flash-once-and-forget “kernel optimizers”, KTweak is driven by the KISS principle. There is not a single compiled component, while the actual codebase (which is nothing but a shell script) is less than 250 lines long. Expand the list below to see all the tweaks that KTweak applies:

List of modifications done by KTweak

  • kernel.perf_cpu_time_max_percent: 25 –> 5
  • kernel.sched_autogroup_enabled: 0 –> 1
  • kernel.sched_enable_thread_grouping: 0 –> 1
  • kernel.sched_child_runs_first: 0 –> 1
  • kernel.sched_downmigrate: 20 20
  • kernel.sched_upmigrate: 80 80
  • kernel.sched_group_downmigrate: 20
  • kernel.sched_group_upmigrate: 80
  • kernel.sched_tunable_scaling: 0
  • kernel.sched_latency_ns: 10000000 (10ms)
  • kernel.sched_min_granularity_ns: 1000000 (1ms)
  • kernel.sched_migration_cost_ns: 500000 (0.5ms) –> 1000000 (1ms)
  • kernel.sched_min_task_util_for_boost: 25
  • kernel.sched_min_task_util_for_colocation: 50
  • kernel.sched_nr_migrate: 32 –> 64
  • kernel.sched_schedstats: 1 –> 0
  • kernel.sched_wakeup_granularity_ns: 1000000 (1ms) –> 5000000 (5ms)
  • kernel.timer_migration: 1 –> 0
  • net.ipv4.tcp_ecn: 2 –> 1
  • net.ipv4.tcp_fastopen: 3
  • net.ipv4.tcp_syncookies: 1 –> 0
  • vm.compact_unevictable_allowed: 1 –> 0
  • vm.dirty_background_ratio: 5 –> 10
  • vm.dirty_ratio: 20 –> 30
  • vm.dirty_expire_centisecs: 300 (3s) –> 1000 (10s)
  • vm.dirty_writeback_centisecs: 500 (5s) –> 0 (0s)
  • vm.extfrag_threshold: 500 –> 750
  • vm.oom_dump_tasks: 1 –> 0
  • vm.page-cluster: 3 –> 0
  • vm.reap_mem_on_sigkill: 0 –> 1
  • vm.stat_interval: 1 –> 10
  • vm.swappiness: 100 –> 80
  • vm.vfs_cache_pressure: 100 –> 200
  • Next Buddy
  • No Strict Skip Buddy
  • No Nontask Capacity
  • TTWU Queue
  • Governor Tweaks
    • hispeed_load: 90 –> 80
    • hispeed_freq
  • CAF CPU Boost Tweaks
    • input_boost_freq: 1.4 GHz
    • input_boost_ms: 250 ms
  • I/O
    • iostats: 1 –> 0
    • readahead: 0
    • nr_requests: 128 –> 512
    • noop / none
  • ZRAM

If you need a thorough insight into all the aforementioned tweaks and how they can boost the performance level of your Android smartphone or tablet, head on over to the module discussion thread linked below. All the tunables and the corresponding enforced values were carefully chosen by the developer based on their effects on real-life usage scenarios, so you know it’s not snake oil. You are also welcome to contribute to the project by submitting pull requests to the module’s GitHub repo.

KTweak Kernel Adjustment Magisk Module — XDA Download and Discussion Thread

The post KTweak is a new kernel adjustment mod that optimizes the performance of Android devices appeared first on xda-developers.



from xda-developers https://ift.tt/34nmGmF
via IFTTT

Aucun commentaire:

Enregistrer un commentaire