• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Development [r1] arter97 kernel for OnePlus 9 series

Search This thread

bsimpson1

Senior Member
Jun 16, 2013
275
85
Is it possible with this kernel to bypass the battery and use the charger for AC power? I think they call it "Battery Idle Mode" in the Advanced Charging Controller app.

The stock kernel on the OP7 Pro had this feature accessible from sysfs under "battery/op_disable_charge" and "battery/input_suspend"
 

lu.thor

New member
May 12, 2020
4
0
Does this kernel have a similar memory management from the previous OP kernel where it's recommended to turn off Ram Boost?

Also, I noticed that the OP9 pro has a F2FS file system by default, remembered formating the OP7 pro and flashing the F2FS optimizing zip file, so I guess newer phones have F2FS formated/optimized flash memory by default?
 

rejectedjs

Senior Member
Apr 1, 2012
380
118
Does this kernel have a similar memory management from the previous OP kernel where it's recommended to turn off Ram Boost?

Also, I noticed that the OP9 pro has a F2FS file system by default, remembered formating the OP7 pro and flashing the F2FS optimizing zip file, so I guess newer phones have F2FS formated/optimized flash memory by default?
For your second question, did you just admit that you have the answer to your own question within the same sentence?
 
  • Like
Reactions: jwarrior319

lu.thor

New member
May 12, 2020
4
0
For your second question, did you just admit that you have the answer to your own question within the same sentence?
No, the second sentence wasn't really a question, more of an assumption which I was hoping to get clarified by someone much smarter than I am.

I remember kernel devs, especially Arter, supporting the file system format, so I was wondering if that was a thing only with the older OnePlus phones or if all phones were eventually moving from ext4 to F2FS; after a bit of DD it seems it's been used for a while now, Samsung started implementing F2FS in their galaxy 10 series, and I guess OnePlus implemented it on the their early models then eventually went back to EXT4, and now back on F2FS. Probably pointless to many, but its nice to see F2FS by default on OnePlus.

The first question may seem stupid, but I disabled RAM boost since day one and so far my battery life has been outstanding with the kernel and the performance remains great.
 

arter97

Recognized Developer
Oct 14, 2012
3,780
33,912
23
Seoul
No, the second sentence wasn't really a question, more of an assumption which I was hoping to get clarified by someone much smarter than I am.

I remember kernel devs, especially Arter, supporting the file system format, so I was wondering if that was a thing only with the older OnePlus phones or if all phones were eventually moving from ext4 to F2FS; after a bit of DD it seems it's been used for a while now, Samsung started implementing F2FS in their galaxy 10 series, and I guess OnePlus implemented it on the their early models then eventually went back to EXT4, and now back on F2FS. Probably pointless to many, but its nice to see F2FS by default on OnePlus.

The first question may seem stupid, but I disabled RAM boost since day one and so far my battery life has been outstanding with the kernel and the performance remains great.

All phones are moving to f2fs. Google is actively encouraging it and fully supporting it in their Android Common Kernel.
Samsung started to use it since Galaxy Tab S6, S20 series, not quite the S10 series.

So yeah, you don't have to do anything to get the most out of it.
 

arter97

Recognized Developer
Oct 14, 2012
3,780
33,912
23
Seoul
Another alpha build with a lot of changes, r1a12 is up.

Now, my kernel's TODO list is done and I hope this kernel is stable enough so that I can move on from the "alpha" tag.
I'm still marking it an alpha as a lot changed.

I've re-uploaded r1a12 as r1a11 was durped.

r1a12
Linux v5.4.150 merged
Touchscreen optimizations
Disabled debugging/unnecessary configs to optimize performance
Backported SELinux from mainline Linux for better performance
Backported BFQ scheduler from mainline Linux for better performance
Backported mremap optimizations (see here for more info)
Fixed more issues related to Type-C audio dongles (thanks to @Freak07)
Backported some meaningful swap memory management commits from mainline
Switched to LRNG for better RNG performance (see here for more info)
Fixed zram writeback not working properly with previous builds
Ported device-specific memory optimizations from my previous OnePlus 7 kernel
Enabled ThinLTO for better compiler optimizations
 
Last edited:

freddienuxx

Senior Member
Dec 11, 2012
1,632
307
OnePlus 8 Pro
OnePlus 8T
great kernel but have a issue I backed up my boot img on fk manager so I can revert. but when I revert from your kernel it gets stuck on boot animation Nottin helps unless I flash your kernel it boots back to OS. how I even extracted latest stock os boot.img and boot vendor img and I still get stuck on boot animation. only thing that works is your kernel. please help thx
 

GreaterLesser

Senior Member
Sep 19, 2014
493
189
Chicago
OnePlus 9 Pro
great kernel but have a issue I backed up my boot img on fk manager so I can revert. but when I revert from your kernel it gets stuck on boot animation Nottin helps unless I flash your kernel it boots back to OS. how I even extracted latest stock os boot.img and boot vendor img and I still get stuck on boot animation. only thing that works is your kernel. please help thx
You're supposed to back up the following 3 partitions:

boot
dtbo
vendor_boot

If you did not backup all three then you will need to install the lastest update package to return to stock. You're going to get a bootloop when restoring only 2 of the 3 partitions mentioned. This was mention in the original post.
 
  • Like
Reactions: Smedslund

freddienuxx

Senior Member
Dec 11, 2012
1,632
307
OnePlus 8 Pro
OnePlus 8T
great kernel but have a issue I backed up my boot img on fk manager so I can revert. but when I revert from your kernel it gets stuck on boot animation Nottin helps unless I flash your kernel it boots back to OS. how I even extracted latest stock os boot.img and boot vendor img and I still get stuck on boot animation. only thing that works is your kernel. please help thx
nevermind had to flash dtbo
 

avid_droid

Senior Member
Aug 24, 2019
2,109
704
Maui,Hawaii
OnePlus 9
You're supposed to back up the following 3 partitions:

boot
dtbo
vendor_boot

If you did not backup all three then you will need to install the lastest update package to return to stock. You're going to get a bootloop when restoring only 2 of the 3 partitions mentioned. This was mention in the original post.
You can also extract these files from payload.bin there is no need to back or flash the whole paclage
 

Top Liked Posts

  • 2
    yeah I'm curious about this too
    Flashed this over Omega, and it's working. Will report performance and battery after a few days.
  • 38
    arter97-xda.png



    arter97 kernel for OnePlus 9 series running OxygenOS

    /* Features */

    Supports OnePlus 9 series
    Fully rebased kernel without unnecessary OnePlus code
    Latest CAF msm-5.4 kernel fully merged
    Latest Linux v5.4 subversion merged
    Latest Google’s security fix merged
    BBR as the default TCP network congestion control
    Features the latest WireGuard
    Modules support disabled for lighter kernel
    Latest Wi-Fi drivers from Qualcomm with customized config
    Built with Clang 12 and ThinLTO
    Power optimizations
    Memory management optimizations
    Latest SELinux subsystem backported from mainline
    Latest f2fs backported from mainline
    Latest BFQ I/O scheduler backported from mainline
    mmap/mremap backported from mainline for a major performance boost
    Touchscreen optimizations for lower latency
    Uses LRNG for better performance

    /* Details */

    - Fully rebased kernel without unnecessary OnePlus code -



    This kernel is not based on the stock OxygenOS kernel source provided by OnePlus. Instead, it’s based on the latest and greatest Qualcomm has to offer. Only the necessary parts from the OnePlus kernel have been cherry-picked, such as OnePlus 9 specific device drivers.

    This effectively kills all kernel modifications/optimizations from OnePlus, including the infamous app throttler.
    Due to the completely different base, this kernel will behave drastically different from other kernels, in both good and bad ways.


    - Power optimizations -


    This kernel makes some conscious decisions for reducing power consumption.

    First, the stock OnePlus configuration forces display-related processes to use the big cores exclusively.
    This configuration brings a huge power regression since it makes every frame dispatch to wake up and use the power-hungry cores.

    This kernel resets this profile to use the configuration Google recommends, which is to use the LITTLE cores exclusively instead.

    Second, this kernel disables wakelocks upon Wi-Fi’s RX unicast packet transmissions. qcom_rx_wakelock is one of the major culprits to increased idle power consumption. Although its total wakelock time is quite low, it's catched very frequently and prevents the system from entering suspend repeatedly.

    As dropping unicast or local ARP packets doesn’t pose practical issues on Android, this kernel disables qcom_rx_wakelock.

    Third, this kernel reduces the duration of the Bluetooth ISR wakelock from 2 seconds to 100ms. This was done from an observation that the average userspace response time from ISR is less than 10ms.
    My kernels have been doing this for years and no Bluetooth-related issues were reported.

    Fourth, the vibrator driver used in this kernel no longer controls the cpuidle driver. The stock kernel disables the cpuidle whenever the vibrator is used. This kernel disables it as the vibrator is not that sensitive to deadline misses.

    There are other small improvements throughout the kernel tree as well.


    - Memory management optimizations -


    This kernel disables LMKD and uses an in-kernel solution called SimpleLMK, made by kerneltoast. You can track how often SimpleLMK kicks in by monitoring:
    Code:
    /sys/module/lowmemorykiller/parameters/lmk_count

    This kernel also changes a lot related to swap and zram.

    The swap-related code has been backported from Linux v5.9 (link1, link2) to efficiently support fast swap device and allow swappiness over 100. This kernel currently sets swappiness to 160 on < 6GB of RAM, 120 on 8GB and 90 on 12GB.

    zram has been also backported from mainline Linux and further tweaked to use block device writeback. This is equivalent to the recent “RAM Plus” feature that companies have been marketing that uses the internal storage to extend RAM.

    This kernel uses zram writeback to offload idle pages (i.e., really, really unused RAM) to the internal storage. As it's extremely slow to bring pages back from UFS, writeback code works quite conservatively. It'll start to writeback pages that haven't been used for a day or two. It makes use of the hidden 2GB “last_parti” partition from the UFS storage.

    Along with zram writeback, this kernel also enables deduplication with xxHash. Each page stored in zram is checked for deduplication to further save memory. With these 2 features combined, RAM reaching 1GB is additionally saved, but your mileage may vary.

    The post boot script used in the stock ROM is also overridden and it sets the readahead to 128KB. As I/O workload under Android is mostly random, high readahead doesn’t help and only increases memory thrashing.

    This kernel also incorporates a lot of patches to reduce/optimize memory allocations used throughout the entire kernel.

    mmap/mremap code was also backported from Linux v5.10 to optimize ART (see here for more info).


    - Latest subsystems -


    This kernel backports the SELinux subsystem from mainline Linux. This includes caching improvements that drastically reduces time spent on lookups. 10K lines of code has been changed.

    This kernel also backports f2fs (Flash-Friendly File System) from mainline Linux. This includes bug fixes and performance improvements such as shorter discard latency, more optimized GC logic for Android, and checkpoint merging.

    BFQ I/O scheduler has also been backported from mainline Linux for better I/O performance.


    - LRNG -


    This kernel ditches the traditional RNG driver from the Linux kernel in favor of LRNG. See here and here for more info.

    A rudimentary throughput benchmark shows an improvement of 10.5% (keep in mind that this is only one aspect of an RNG metric).


    /* Notice */

    Only OxygenOS on Android 11 is supported.

    This kernel touches vendor_boot and dtbo partitions, meaning you'd need to restore said partitions whenever you're switching to another kernel or stock.
    Please make a back-up of these partitions. The installer doesn’t do this automatically for you. Installing the stock ROM with a full OTA restores said partitions as well.

    /* Disclaimer */

    Your warranty is now void.
    I am not responsible for bricked devices, dead SD cards,
    thermonuclear war, or you getting fired because the alarm app failed. Please
    do some research if you have any concerns about features included in this kernel
    before flashing it! YOU are choosing to make these modifications, and if
    you point the finger at me for messing up your device, I will laugh at you. Hard. A lot.

    /* Thanks to */

    Vishalcj17
    kristofpetho
    kdrag0n
    kerneltoast (SultanXDA)

    /* Instructions */

    1. Read the above. Please.
    2. Flash the zip file from FK Kernel Manager. Any other installation methods are untested.

    /* Downloads and links */

    arter97.com
    Kernel source
    Telegram chat link
    15
    After using the kernel myself and daily driving for few days and monitoring how the kernel behaves, I now feel comfortable to mark it stable.

    r1 is released.

    The original post is re-written to feature what's special with this kernel.
    Please take your time and re-read the original post.
    9
    Another new alpha build is up with big changes yet again.
    I still have quite a few TODOs left, but I ported many changes from my OnePlus 7 Pro kernel.

    Wi-Fi will behave differently with this kernel, so please let me know if you encounter Wi-Fi issues.

    r1a7

    Wi-Fi configuration merged with the latest CAF
    Wi-Fi's rx_wakelock disabled and removed
    Support for WireGuard added
    Bunch of memory optimizations
    Bunch of optimizations for screen and the GPU driver
    9
    r1a10 is up. (r1a9 is skipped as an internal build)

    This build now drastically changes the file-system code, bringing it from v5.4 to v5.15 (mainline Linux) with 13K code line changes.

    While I expect it to be stable, there might be a possibility that it may end up causing incompatibilities with the OnePlus 9's encryption code.

    So please, back up your data before using this build if you haven't already.

    Another notable change is that the USB OTG and Type-C audio jack is also fixed.

    r1a10

    Merged the latest Qualcomm LA.UM.9.14.r1-18300-LAHAINA.0 tag
    Fixed USB OTG and Type-C audio jack
    Merged the mainline f2fs from Linux v5.15
    8
    r1a13 is up for minor bug fix.
    Previous builds may have silently corrupted memory due to zram. All users are advised to upgrade to r1a13.

    r1a13
    Hashing algorithm switched from crc32c to xxh64 from zram to reduce collision