Kernel V4.4 _ Improvements and optimizations. - LGE-G5-G6-V20/msm8996_lge_kernel GitHub Wiki

Improvements and general optimizations to be done in 4.4

This section is dedicated to the improvements we are going to make on the kernel's source, so while not being directly related to bug fixing, those are still useful things to track, since we might need to revert them later.

Stable + Dev branches (also goes into Swan2000)


  • Build using OPTIMIZE_FOR_PERFORMANCE (O2), the default for the standard linux kernel, instead of OPTIMIZE_FOR_SIZE (Os). - Done, but doesn't work well, so it was dropped

Here's the commit with that optimization.


  • Pull in some CFQ I/O Scheduler patches, we could use a better scheduler to help the storage's overall performance.

  • Try to support F2FS. It's a good alternative to EXT4, being faster and just as safe these days. - Dropped, 4.9 is the bare minimum for decent F2FS support.

  • Improve the charging curve. It's way slower than 3.18 and stock for now, even on smaller batteries. Seems to trigger somewhere around 50%, where it goes from fast charging to slow charging.

  • Pull in EAS (Energy-Aware Scheduling). 3.18 has it, and 4.4 might become even more responsive with it. - Done.

Commits (the most relevant ones):

Commit 1

Commit 2

Commit 3

Commit 4

Commit 5


  • Update the energy model for both msm8996 and msm8996pro with the help of freqbench - Partially done. 8996 has its new model, but 8996pro wasn't able to run freqbench yet, so we're assuming some values for the time being.

Commits:

Commit 1

Commit 2


  • Enable the LZ4 compression algorithm for ZRAM, we're currently using LZO which is much slower. - Done, although the kernel will still default to LZO, giving rom devs and users the choice to use LZ4.

Here's the commit, in case it needs to be removed for LOS official, although it doesn't break any of their rules:


  • After we get audio working -> Update the lge dai link registration based on their msm8998 sources - Done

Commit


  • More to come...

Swan2000-exclusive adjustments (includes potentially unsafe optimizations, and things that conflict with LOS official guidelines)


  • Add more clock steps on msm8996pro's little cluster. It has a massive jump from 1593MHz all the way up to 2188MHz. - Done in the previous tree, added the intermediate step of 1785MHz that is already available on the kernel's source and was just unused. Commit.

  • Update the undervolt curve of the CPU and GPU. -60mV across the board on all Kryo cores appears to be stable on both Swan 3.18 and mk2000 3.18, but we might bring it down to -50mV to be even safer (and because stock already has around -30mV on the highest clocks). The GPU on the other hand, can be seriously undervolted thanks to qcom's ceiling voltages of 1065mV on the 8996pro's highest clock of 652MHz for example (and the SoC sets a voltage that's way lower than that). On that same clock speed, even a ceiling of 860mV is considered stable, only really showing artifacts when going below 815mV.

  • Add some ARM routine optimizations, such as the ones from xiaomi vayu.

  • Cherry-pick certain performance-improving commits known to be stable from kerneltoast, with some examples being this, this and this.

  • Get some memory optimization commits, such as this one

  • Possibly add kerneltoast's SimpleLMK to help with memory management, assuming we can benefit from it.

  • It might be possible to backport some of the commits from this V40 source.

  • Add 900mA USB fast charging (on usual USB ports like a PC/laptop) - Done in the previous tree, on this commit.