Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

lineage-17.1-20201014

Compare
Choose a tag to compare
@BYZYB BYZYB released this 14 Oct 07:38
· 65 commits to lineage-17.1 since this release
a40e51f

Clang/LLVM support for 3.10.y kernel

Switch from gcc to clang

In many conditions, clang will generate better codes than gcc in less time. It's also reported that the executable binaries built by clang runs faster than the one from gcc. What's more, the prebuilt gcc-4.9 is removed from Android 11 sources, which may cause build errors if the kernel doesn't add support to clang/llvm, or the users didn't specify custom gcc toolchains (just like how I used gcc-10 to build the kernel before).

Therefore, switching from gcc to clang has become a high priority plan. Currently, only linux-4.4 and later has clang/llvm build support, there is also some patches for linux-3.18 . Backport such things to linux-3.10 is theoretically possible (as the C/C++ codes in linux kernel is always C/C++), but takes much time to check all patches and do build tests.

At early time, the kernel built with clang-10 would panic if WLAN is enabled (there must be something wrong in qcacld-2.0 driver), without a chance to get kernel logs (because ADB also crashed and I have no way to access UART on Mi-4c currently). After taking some patches to fix OOM and improve stability, the kernel finally worked with WLAN enabled (but there is no actual changes to qcacld-2.0 driver, maybe memory overlaps? or some problems from clang-10 itself?). At last, the clang-11 on Ubuntu 20.10 built a stable kernel image that works properly, made a well beginning.

In my daily use (for test), the kernel built with clang provides better performance than the one with gcc-10, even with less aggressive scaling up time for "sched" CPU scheduler. No issue was found currently, but my use cases may not include all available situations. If you got into trouble with this release, please give me a feedback.

Known issue

  • LTO must be disabled (in libra_defconfig) to keep gcc-9/10 compatibility, or vmlinux won't link properly. This issue doesn't affect most users, unless someone wants to build the kernel using gcc toolchains.

For more details (or contribution), please go to android_kernel_xiaomi_libra and see pull requests.

Reduce resource consumption

Disable system logs

It's highly recommended to disable system logs to reduce resource consumption (for better performance and privacy), unless you're going to collect system logs. Like the following picture: go to "Settings - System - Developer options - Logger buffer sizes", and set the value to "off".

Main changes

  • Android Security Patch level: 10/5/2020.
  • Drop Wifi Display support (no native implementation in Android 9+).
  • Improve I/O performance (disable atime and write barrier).
  • Organize the name of libshims.
  • Remove dirac blobs (not used).
  • Remove libhidltransport and libhwbinder from vendor libs.
  • Remove sepolicy hacks of addon-su (to avoid build errors without patch).
  • Kernel improvements:
    • Build with clang-11 on Ubuntu 20.10 (better performance).
    • Fix some memory leaks to improve stability.
    • Merge more upstream changes of F2FS.
    • Remove custom KTM changes by flar2.
    • Update fsnotify module (inline with linux-3.18, may need in Android 11).
    • Use full link-time optimization (LTO) in build process.
    • Use less aggressive up scaling time for "sched" CPU scheduler.
    • Stability improvements for KTM (inline with caf-LA.BR.1.3.6.c25).
  • Use the consumerir HAL from android_hardware_xiaomi.

Download mirror