[OnePlus 7 Pro ROMs, Kernels, Recoveries, & Other D] Freak07:
Update to 1.2.0

Hey guys and girls,

So here is the huge update. I have thought about it for quite a bit if I should bump the kernel to 2.0.0 with this release, but I decided against it. After all numbers aren´t everything. At first I wanted to release 1.0.1, then 1.05 and after 1.1.0 I suddenly ended up at 1.2.0.

This is really a huge update and I hope everyone appreciates the time and effort put into it. Before I continue and try to describe and document all the changes introduced, a huge thanks to [MENTION=5582262]rav101[/MENTION]. He spent quite some time testing all the changes with me.

Before you decide to not read further take a look at the new flashing instructions either in this post or in the OP!!

So now lets go to the release. A bit of a story before:

The first Kirisakura-Kernel was published for the Pixel/XL. Since back then I always tried to learn a lot and contribute something for the community. I´m still learning with every release that´s published.

If you have question simply ask it. I´m quite open to discussion as long as it stays healthy. Same for feature requests, if I think they´re justified for good reasons I may add them.

Recently dropped the biggest update yet for my pixel 3 XL kernel. Read more about it at the link.

The OnePlus 7 Pro kernel I want to provide here will go into the same direction. The kernel base is upstreamed to latest linux-stable for our 4.14 kernel base.

1.0.0 for the OP7 Pro already included the merge of the, at this point in time, latest available CAF source. Both of this contributes to having the latest code available running on this device thereby improving stability and security.

I worked with a few devices of different brands now. Mostly HTC and Pixel. I try to bring improvements and tricks, I learned along the way from both devices to this kernel.

The general aim with this kernel will be stability, a set of features that actually enhance the experience when interacting with the device. I´m trying to make it perform the most efficient way possible.

Like I mentioned in a previous post, I want my device to complete every task I throw at it, as fast as possible with the most possible efficiency. I don´t like fine tuning any kernel sysfs knobs to special use case scenarios.

The few tunables that get set via my magisk module, are for an improved general user experience. Much is borrowed from the Pixels and HTC.

I made a few discoveries with how OP set up ZRAM after discussing about ZRAM, with someone that contacted me after my post about ZRAM earlier here. I decided to change the way ZRAM is utilized on the OP7 Pro a bit. More on that below.

Changelog:

Kernel Base Changes

- 4.14.123 merged

- latest CAF tag LA.UM.7.1.r1-14400 merged for improved security, stability and performance

EAS:

- improved schedutil governor

- mimic pixels setup of the schedutil governor

- use schedtune boost from [MENTION=6745491]joshuous[/MENTION] to mimic Pixel-like EAS schedtune boosting behaviour

- setup cpusets like on pixel for more efficiency and better performance

Filesystem related changes:

- use blkio/cfq/cgroup setup from Pixel 3a devices.

Pixel 3a devices´s storage isn´t as fast as other ufs storage devices. In order to improve I/O on these devices, google implemented this mechanism. It improves I/O performance in scenarios where a big I/O workload , that must apparently be completed as fast as possible, exists, but might slow other tasks down heavily.

This can happen for example when updating an app from the play store, copying big files, writing large junks of data.

With these new changes this should end up in the background cgroup, which has less priority than UX-critical services. Improving I/O performance even further on our phone.

This is done in a combination of the kernel.zip and the magisk module.

GPU related changes:

CAF introduced in this commit an official new GPU step at 675mhz for a special binning of the SD855. I just enabled it so you´re able to use this offical new GPU step on the OP7/Pro.

By default your phone will use 585MHZ like on the stock kernel. You can easily enable the new step in EXKM after booting.

GFX Bench with stock 585MHZ:

GFX Bench with 675MHZ:

Display changes

- some display tweaks to maybe reduce power consumption on statically rendered images

Memory related changes

- disabled smartboost and memboost from OP

- enabled per process reclaim

- change the way ZRAM is used by quite a bit

- allow ZRAM to use higher swappiness values than 100

With smartboost and memboost One Plus forces more stuff into memory than needed. I disabled both of those features. This potentially breaks the RAM-Boost in Settings! I don´t want that feature in my kernel after taking a look at it.

I enabled per process reclaiming instead. It avoid killing apps in memory to get more free RAM. This is not needed on any of the OP7Pro devices with more than enough RAM available. It´s enabled on the Q Beta from the Pixel 3 as well. It works very nicely and I had some good experiences with it. Same goes for games and other apps.

Typical scenario: Watching a youtube video in the evening. You pause the video go to sleep. Next evening, after roughly 24 hours you open the youtube app again. Although it was removed from memory, the apps now returns precisely to that screen, where you paused the video. This might need a tiny bit of CPU in the end, but it´s convience I like to have. Try it, I´m sure you´ll notice it sooner or later. This all will of course only apply if you don´t reboot between those days.

One Plus uses a combination of a SWAP file (which i really dislike) and ZRAM (which I like) at 4GB (!) size in conjuntion with their memboost and smartboost feature to stuff more things into RAM than the kernel normally would. Both these features are now disabled.

Additionally change the way ZRAM is initialized.

My kernel now sets up only ZRAM as 1/8 of your total RAM during each boot process. No swap file on storage is generated. Swappiness is set at 190 for a start. ( I hear you, has he lost his mind...)

Here´s an article that´s very interesting to read, I recommend it to everyone: https://lwn.net/Articles/690079/

A few excerpts:

Is swapping still bad?

User-accessible memory on a Linux system is divided into two broad classes: file-backed and anonymous.
File-backed pages (or page-cache pages) correspond to a segment of a file on disk; if they do not contain newly written data that has not yet made it back to persistent storage, these pages can be easily reclaimed for other uses.
Anonymous pages do not correspond to a file on disk; they hold the run-time data generated and used by a process.
Reclaiming an anonymous page requires writing its contents to the swap device.

As a general rule, reclaiming anonymous pages (swapping) is seen as being considerably more expensive than reclaiming file-backed pages.
One of the key reasons for this difference is that file-backed pages can be read from (and written to) persistent storage in large, contiguous chunks, while anonymous pages tend to be scattered randomly on the swap device.
On a rotating storage device, scattered I/O operations are expensive, so a system that is doing a lot of swapping will slow down considerably.
It is far faster to read a bunch of sequentially stored file-backed pages — and, since the file is usually current on disk, those pages may not need to be written at reclaim time at all.

Swapping is so much slower that many administrators try to configure their systems to do as little swapping as possible.
At its most extreme, this can involve not setting up a swap device at all; this common practice deprives the kernel of any way to reclaim anonymous pages, regardless of whether that memory could be put to better use elsewhere.
An intermediate step is to use the swappiness tuning knob (described here in 2004) to bias the system strongly toward reclaiming file-backed pages.
Setting swappiness to zero will cause the kernel to swap only when memory pressure reaches dire levels.

Johannes starts off his patch set by noting that this mechanism was designed around the characteristics of rotating storage.
Anytime the drive used for swapping needed to perform a seek — which would happen often with randomly placed I/O — throughput would drop dramatically.
Hence the strong aversion to swapping if it could possibly be avoided. But, Johannes notes, technology has moved on and some of these decisions should be reconsidered:

With the proliferation of fast random IO devices such as SSDs and persistent memory, though, swap becomes interesting again.
Not just as a last-resort overflow, but as an extension of memory that can be used to optimize the in-memory balance between the page cache and the anonymous workingset even during moderate load.
Our current reclaim choices don't exploit the potential of this hardware.

Not only should the system be more willing to swap out anonymous memory, Johannes claims, but, at times, swapping may well be a better option than reclaiming page-cache pages.
That could be true if the swap device is faster than the drives used to hold files; it is also true if the system is reclaiming needed file-backed pages while memory is clogged with unused anonymous pages.

The first step in the patch set is to widen the range of possible settings for the swappiness knob.
In current kernels, it can go from zero (no swapping at all if possible) to 100 (reclaim anonymous and file-backed pages equally).
Johannes raises the maximum to 200; at that value, the system will strongly favor swapping. That is a possibility nobody has ever wanted before, but fast drives have now made it useful.

As I hinted earlier HTC and other OEMs use values above 100 for ZRAM swapping. Trying to achieve exactly what is written there.

We´ll start with a swappiness of 190, but maybe will decrease it, once it is widely tested.

Memory management for me was absolutely fantastic and I hope it will be for you all too.

Other Important Changes

- This kernel uses now it´s own inbuilt WLAN driver straightly from CAF

This means we´re not longer depending on force loading the WLAN module, which introduces all sorts of issues.

To quickly explain. The Wlan driver can either be built separately as a module or inline directly into the kernel. One Plus decided to built it as a module separately from the kernel and don´t publish the kernel source! This is a very bad situation.

As the kernel changes, some symbols inside the kernel change and the pre built WLAN module, that ships with the OS, won´t load. Then you need to force the module to load, like the other kernels and 1.0.0 of this kernel too.

Eventually, with big changes to deeper levels, like the scheduler, introduced, the wlan module won´t work even force loaded. This is the case with release 1.2.0.

Luckily I managed to get WLAN working by adding the WLAN driver directly from CAF and load it on boot :) thanks to a certain very helpful and friendly person around here ;) He will know ;)

That means we can now also change things in the WLAN driver in the future, which is quite nice :)

- audio/techpack driver updated with latest CAF source

Anykernel Changes

- zip is now flashable in EXKM

- bump from AK2 to AK3, huge thanks to [MENTION=4544860]osm0sis[/MENTION] and the honor of letting me test AK3

Have fun flashing and enjoy your device with latest linux-stable :)

Why is linux-stable important?

I wish you all a nice day/evening!

Download is below :)

Download:

Disclaimer/Important:

Before flashing make sure you´re on latest stable Magisk 19.2!

In case you´re on the stock kernel or any kernel, which has AVB not disabled, you have to flash the kernel.zip TWICE in EXKM with a reboot in between in order for the files on vendor to be replaced!

Otherwise AVB verity prevents these files from being replaced.

This kernel changes some files in /system/vendor. Below is a zip you can flash to return to stock for your convenience. Afterwards restore the stock boot.img

Kernel: https://www.androidfilehost.com/?fid=6006931924117887606

Magisk Module: https://www.androidfilehost.com/?fid=6006931924117887605

Restore-Files Zip:https://www.androidfilehost.com/?fid=6006931924117887604

or following the link in the op to the correction version

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

If you like my work please consider a donation.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea: http://paypal.me/freak07