-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Hi, I compiled a custom kernel for my reMarkable 1 and was talking about the changes to the configs I made in the discord. It was suggested I share them here, as they may be useful to include in the default kernel to improve performance, battery life or both.
The following changes I see no reason not to have on all kernels:
- Disable high memory support - the default config enables support for memory addresses greater than 4GB. This seems like an over sight, and disabling it yields a faster kernel.
- Trim unused kernel symbols - this makes the kernel smaller and gives greater compiler optimization opportunity on the kernel source. Some external kernel modules require the ones that are trimmed, but I've trimmed them in my kernel and my rm1 works fine. I obviously can't be certain myself but it's fair to assume this is at least worth looking at. It should be mentioned I haven't found time to build a kernel that includes the proprietary wifi driver yet though, so for all I know perhaps this relies on something from here.
- Disable SLUB debugging - this adds to the kernel binary size and serves no purpose
I've made some more changes that I'm slightly uncertain about for enabling by default, but will share them anyway:
- Disable watchdog timer - this takes up memory and CPU cycles in the background, taking up usage and draining battery. Supposedly though it might be useful for breaking out of bootloops, but I'm not sure how much of an issue this is on the rm1. If it's not, this should definitely be considered for removal.
- Optimize very likely/unlikely branches - this should make the kernel run faster most of the time and very occasionally run slower on some operations. I decided to make the trade off, I'm not sure which might be preferred for default usage though.
- 1khz over 100hz frequency timer - this makes a trade off between latency to responding to hardware interrupts and battery life as well as the amount of cache space the kernel takes up. I'm less sure if this is really worth it, but I think it's safe to assume drawing on the screen includes a hardware interrupt here, and so might even reduce latency? I'm unable to benchmark it, but I thought would be worth mentioning here anyway. Obviously needs to be taken into account with whatever, if even slight, reductions in battery life too. There are also middle grounds between these two extremes.
- Patched for real time preemption - the default kernel is set at involuntary preemption, or 'low latency desktop'. This is a trade off between responsiveness and max CPU throughput. I figured in a similar fashion to the timer frequency, enabling even more preemption should reduce latency, and in this case not even specifically to hardware interrupts but to all user space software, especially when the CPU is under load. Obviously though this is a separate patch that needs to be applied, and may not even be worth it at all, but once again thought it would be worth mentioning.
- Switch from LZO compression to LZ4 - This makes the kernel slightly bigger but decreases boot times. As it's already at LZO I figured it's assumed the additional speed isn't worth the additional space, but I decided to make this trade off myself anyway.
I'm an armature coming at this with little experience, so forgive me if everything here has already been considered and accounted for, but I figured if there was a chance even one of these things hadn't been thought of in the existing config it could be useful to flag up! I will say, though I haven't benchmarked regular usage performance or screen latency, I have recorded an almost exactly three second decrease in boot time with these settings, which I think is fairly significant.