(info guide) --- i/o scheduler --- - HTC Sensation

The Scheduler is an algorithm that, given a set of requests for access to a resource, establishing a temporal order for the execution of such requests, favoring those that meet certain criteria in order to optimize access to that resource.
The difference between the various scheduler is the focus on certain criteria rather than on others.
The choice of a given scheduler does not produce visible changes so as to the choice of the governor, but still provides some improvements.
As usual schedulers are personally tested to find one that best suits your needs.
Deadline
It aims to provide a deadline, a deadline for all requests in order to avoid undesirable phenomena such as the "starvation" or the eternal waiting for some requests that occurs when one or more background processes are left indefinitely in the queue the ready, because there is always at least one of the highest priority ready process.
V (r)
The next request is performed according to the distance from the last request. In the network running good opinions about this scheduler.
No-op
Push all requests in a single queue simply by their arrival order, grouping together those contiguous.
SIO
E 'the scheduler simpler, does not make any type of sort, is intended only for the purpose of obtaining a low-latency, ie to reduce the amount of time that elapses between the instant at which the request is generated and that in which the request is satisfied.
CFQ
Order requests of different processes in queues for each queue type and assigns a specific interval of time whose duration depends on the priorities assigned to processes. Can be considered the Ondemand the scheduler, the scheduler is in fact more balanced, doing its job in an honest manner.
BFQ
It 's based on CFQ but, instead of the intervals of time, assigns a part of the bandwidth of the disc to each process running in a proportional manner.
Anticipatory
Order requests based on criteria predictive, that puts the demands paused for a short period of time in anticipation that more of this to come to aggregate them.
ADAPTIVE ANTICIPATORY SCHEDULER
For the anticipatory scheduler, we scale up the anticipation timeout (antic expire) using the latency scaling factor over time. When the virtual disk latencies are low a small scaling of the timeout is sucient to prevent deceptive idleness, whereas when the latencies are high a larger scaling of the timeout value may be required to achieve the same. Note that such dynamic setting of the timeout value ensures that we attain a good trade-o between throughput (lost due to idling) and deceptive idleness mitigation. Setting a high value for the scaling factor (increasing idling time) only happens when the disk service latencies themselves are higher. This may not necessarily cause a signicant loss in throughput, because submitting a request from another process instead of idling is not going to improve throughput if the virtual disk itself does not get any faster than it is at the current period. A higher anticipation timeout might also be capable of absorbing process scheduling eects inside the VM. The results for the adaptive anticipatory scheduler are shown in Figure 2. The read time with our modied implementation (third bar in the dierent scheduler combinations) shows that it is possible to mitigate the eects of deceptive idleness by adapting the timeout. An interesting related observation is that the level to which the improve- ment is possible varies for dierent Domain-0 schedulers; noop - 39%, anticipatory - 67% and cfq - 36%. This again points to the fact that the I/O scheduler used in Domain-0 is important for the VM's ability in enforcing I/O scheduling guarantees. Dierent Domain-0 I/O schedulers likely have a dierent service latency footprint inside the VMs, contributing to dierent levels of improvement.
ROW
Row stands for READ Over WRITE which is the main requests dispatch policy of this algorithm. The ROW IO scheduler was developed with the mobile devices needs in mind. In mobile devices we favor user experience upon everything else, thus we want to give READ IO requests as much priority as possible. In mobile devices we won't have as much parallel threads as on desktops. Usually it's a single thread or at most 2 simultaneous working threads for read & write. Favoring READ requests over WRITEs decreases the READ latency greatly.
The main idea of the ROW scheduling policy is: If there are READ requests in pipe - dispatch them but don't starve the WRITE requests too much. Bellow you'll find a small comparison of ROW to existing schedulers. The test that was run for these measurements is parallel read and write.
FIOS
Flash-based solid-state drives (SSDs) have the potential to eliminate the I/O bottlenecks in data-intensive applications However the large performance discrepancy between Flash reads and writes introduces challenges for fair resource usage. Further, existing fair queuing and quanta-based I/O schedulers poorly manage the I/O anticipation for Flash I/O fairness and efficiency. Some also suppress the I/O parallelism which causes substantial performance degradation on Flash. This paper develops FIOS, a new Flash I/O scheduler that attains fairness and high efficiency at the same time. FIOS employs a fair I/O time-slice management with mechanisms for read preference, parallelism, and fairness-oriented I/O anticipation. Evaluation demonstrates that FIOS achieves substantially better fairness and efficiency compared to the Linux CFQ scheduler, the SFQ(D) fair queuing scheduler, and the Argon quanta-based scheduler on several Flash-based storage devices (including a CompactFlash card in a low-power wimpy node). In particular, FIOS reduces the worst-case slowdown bya factor of 2.3 or more when the read-only SPECweb workload runs together with the write-intensive TPC

Thank you for this guide. Just followed your link from the post about governors.
I've always fancied SIO over others based only on advices from other users.
After reading your guide I've switched to VR. Gonna test it for some time. (I'm looking mainly for lags or their absence).
If I could ask you for something, it would be a word or two about ROW scheduler. From what I noticed it appeared quite recently and is a default for many new kernels. It would great to learn more about it.
Thank you once again for your time!
⇜ SGS+ ↭ SlimBean 4.2.2 build 3 ↭ K^Kernel JB V1.6 OC exUV 370MB ↭ InfinityEngine V2.1 ⇝

Added I / O scheduler ROW

stempox said:
Added I/O scheduler ROW
Click to expand...
Click to collapse
Now that I've read it I'm thinking about changing VR to ROW.
Do you know of any means I can test the difference?
I mean it's not that easy to guess just by user experience which one is better, because from what I can understand it's just hard to observe.
Its another kind of story with governors, because their impact on battery life and performance is almost instant.
With schedulers I can't even notice any change. SIO worked alright to me. After a lecture of this thread I've decided to switch to VR and it works for me as well. Now, after you've updated this thread, I'm thinking that ROW should be better just by its design.
Still I have no idea how to test it. Do you have any advice for me?
PS. Thank you for your time and effort!
⇜ SGS+ ↭ SlimBean 4.2.2 build 3 ↭ K^Kernel JB V1.7 OC exUV 390MB ↭ InfinityEngine V2.1 ⇝

OP update

Thanks for the guide. I don't understand all of the options but it's a good start and I can google for more.

Took me some days to learn about governors from various sources so never tried to learn about i/o scheduler. this looks brief will try to get some info from here....Thanks:good:

stempox said:
The Scheduler is an algorithm that, given a set of requests for access to a resource, establishing a temporal order for the execution of such requests, favoring those that meet certain criteria in order to optimize access to that resource.
The difference between the various scheduler is the focus on certain criteria rather than on others.
The choice of a given scheduler does not produce visible changes so as to the choice of the governor, but still provides some improvements.
As usual schedulers are personally tested to find one that best suits your needs.
Deadline
It aims to provide a deadline, a deadline for all requests in order to avoid undesirable phenomena such as the "starvation" or the eternal waiting for some requests that occurs when one or more background processes are left indefinitely in the queue the ready, because there is always at least one of the highest priority ready process.
V (r)
The next request is performed according to the distance from the last request. In the network running good opinions about this scheduler.
No-op
Push all requests in a single queue simply by their arrival order, grouping together those contiguous.
SIO
E 'the scheduler simpler, does not make any type of sort, is intended only for the purpose of obtaining a low-latency, ie to reduce the amount of time that elapses between the instant at which the request is generated and that in which the request is satisfied.
CFQ
Order requests of different processes in queues for each queue type and assigns a specific interval of time whose duration depends on the priorities assigned to processes. Can be considered the Ondemand the scheduler, the scheduler is in fact more balanced, doing its job in an honest manner.
BFQ
It 's based on CFQ but, instead of the intervals of time, assigns a part of the bandwidth of the disc to each process running in a proportional manner.
Anticipatory
Order requests based on criteria predictive, that puts the demands paused for a short period of time in anticipation that more of this to come to aggregate them.
ADAPTIVE ANTICIPATORY SCHEDULER
For the anticipatory scheduler, we scale up the anticipation timeout (antic expire) using the latency scaling factor over time. When the virtual disk latencies are low a small scaling of the timeout is sucient to prevent deceptive idleness, whereas when the latencies are high a larger scaling of the timeout value may be required to achieve the same. Note that such dynamic setting of the timeout value ensures that we attain a good trade-o between throughput (lost due to idling) and deceptive idleness mitigation. Setting a high value for the scaling factor (increasing idling time) only happens when the disk service latencies themselves are higher. This may not necessarily cause a signicant loss in throughput, because submitting a request from another process instead of idling is not going to improve throughput if the virtual disk itself does not get any faster than it is at the current period. A higher anticipation timeout might also be capable of absorbing process scheduling eects inside the VM. The results for the adaptive anticipatory scheduler are shown in Figure 2. The read time with our modied implementation (third bar in the dierent scheduler combinations) shows that it is possible to mitigate the eects of deceptive idleness by adapting the timeout. An interesting related observation is that the level to which the improve- ment is possible varies for dierent Domain-0 schedulers; noop - 39%, anticipatory - 67% and cfq - 36%. This again points to the fact that the I/O scheduler used in Domain-0 is important for the VM's ability in enforcing I/O scheduling guarantees. Dierent Domain-0 I/O schedulers likely have a dierent service latency footprint inside the VMs, contributing to dierent levels of improvement.
ROW
Row stands for READ Over WRITE which is the main requests dispatch policy of this algorithm. The ROW IO scheduler was developed with the mobile devices needs in mind. In mobile devices we favor user experience upon everything else, thus we want to give READ IO requests as much priority as possible. In mobile devices we won't have as much parallel threads as on desktops. Usually it's a single thread or at most 2 simultaneous working threads for read & write. Favoring READ requests over WRITEs decreases the READ latency greatly.
The main idea of the ROW scheduling policy is: If there are READ requests in pipe - dispatch them but don't starve the WRITE requests too much. Bellow you'll find a small comparison of ROW to existing schedulers. The test that was run for these measurements is parallel read and write.
FIOS
Flash-based solid-state drives (SSDs) have the potential to eliminate the I/O bottlenecks in data-intensive applications However the large performance discrepancy between Flash reads and writes introduces challenges for fair resource usage. Further, existing fair queuing and quanta-based I/O schedulers poorly manage the I/O anticipation for Flash I/O fairness and efficiency. Some also suppress the I/O parallelism which causes substantial performance degradation on Flash. This paper develops FIOS, a new Flash I/O scheduler that attains fairness and high efficiency at the same time. FIOS employs a fair I/O time-slice management with mechanisms for read preference, parallelism, and fairness-oriented I/O anticipation. Evaluation demonstrates that FIOS achieves substantially better fairness and efficiency compared to the Linux CFQ scheduler, the SFQ(D) fair queuing scheduler, and the Argon quanta-based scheduler on several Flash-based storage devices (including a CompactFlash card in a low-power wimpy node). In particular, FIOS reduces the worst-case slowdown bya factor of 2.3 or more when the read-only SPECweb workload runs together with the write-intensive TPC
Click to expand...
Click to collapse
thanks for this, only understandable explanation i've found so far

Thanks

/storage/emulated/0/busybox-arm

Related

Voltage Control - noop, acticipatory, deadline, cfq

Which of these settings do you use and why? I cant really find anything on them.. Dont know which to pick?
Thanks!
I would like to know the answer to this as well.
Me also
Sent from my SGH-I897 using XDA App
Huh?
Sent from my SAMSUNG-SGH-I897 using XDA App
download oclf from the market (but don't do anything with it) once you have it open it and check out the scheduler settings and in there you will find a good definition of each one and what they do.....sorry, too lazy to look it up and put what it says here
Sent from my Galaxy S Captivate with Assonance 5.2!
Noop.
I read that it's designed fire flash memory, and not spinning drives like the others.
Never did any kind of testing though.
Sent from my Captivate.
yeah i've read also that noop is the best since its meant for SSD's
I use noop, but seriously... effect of this setting is extremely negligible.
Noop should cause minimum CPU overhead and work well on 'well-built' flash memory with correctly working FTL, however SGS appears to have FTL performance problems,(something like first Jmicron's JMF602 based SSD's)
nonetheless I still stick to it.
psufan5 said:
Which of these settings do you use and why? I cant really find anything on them.. Dont know which to pick?
Thanks!
Click to expand...
Click to collapse
Had no clue until I read the following:
en.wikipedia.org/wiki/Noop_scheduler
redhat.com/magazine/008jun05/features/schedulers/
Sorry, site rules wouldn't allow me to make these hyperlinks.
I always use noop as it gives me better stability but I was surprised to read that hardcores kernel is tuned for cfq...I do not see any performance difference though just better stability with noop.
Usually I find I can uv more with CFQ. I have no idea why.
Yea I have always left mine on Noop with Paragon; 1.28 and it froze maybe....2 times in the past month?
And im at 75,100,125,125,125,125
Captivate 2.2.1 Paragon
I found some great definitions of for noop, anticipatory, deadline, cfq on this website...
www dot admon dot org/a-comparison-of-io-schedulers/
The site won't let me put in a link so put a period where "dot" is.
Here they are...
Noop - Noop is the simplest scheduler present in Linux. It is mostly suitable for truly random-access block devices, such as flash memory
cards. The incoming requests for read/write are kept in FIFO order, and only the current request added at the end of the queue is tested for
the possibility of merging. The downside is clear; you get no optimization at all, especially in situations where there are many
competing read/write processes. Per process sequential readings will be seen as “random” access. So, it’s better not to use this scheduler with
any sequential access device, such as a hard disk.
Anticipatory - The Anticipatory scheduler is designed around the fact that a user tends to access adjacent sectors instead of jumping to other disk areas
during certain periods of time. Most file systems in Linux use a specific approach to ensure that sectors belonging to a file are kept
adjacent as much as possible. Between these reads, it is very likely that the task sleeps for a while before continuing reading.
So, the basic idea behind the Anticipatory scheduler is that it anticipates subsequent reads between sleeps. By staying a bit longer in
the same head position, it can reduce the back-and-forth seek movement to a certain degree. How long it should stay is sometimes determined by
looking into the next incoming read request, or in some cases by forecasting based on statistics. It is clear then that the Anticipatory
scheduler isn’t really great for time-sensitive read/write processes. The CFQ scheduler shares the same cons, although it is a bit better
because of its “fairness” ability, which we’ll describe later.
Deadline - If you have a lot of requests, you may want to make sure a request is serviced within a strict period of time. This situation is quite
common for a busy file server, but you can see it on desktop workload, too (e.g., graphics rendering). The Deadline scheduler was created to
address this need. Read and write processes are guaranteed to be serviced within a strict amount of time, and read is prioritized over
write. So, the Deadline scheduler pays attention to latency issues but not necessarily throughput.
Read is favored over write, because read is assumed to be more important; however, write operations aren’t allowed to be starved too
much. This behavior can also be tweaked with some tunables, which we’ll talk more about later.
The Deadline scheduler is a sound fit for high-performance I/O because it decreases the interactivity to a certain degree. For someone who
demands smooth desktop experience, however, this might not be the scheduler to choose.
CFQ - CFQ is the default scheduler used in the latest kernel versions, and it is typically suited for people seeking balanced I/O service. Stressing
“fairness”, it tries to manage read/write processes using priorities so that nothing dominates or fully dictates the way the kernel serves
these requests. This is done by dividing the bandwidth of each block device fairly among the processes performing I/O to that device. Lately
it has also been improved by the time slice-based operation, meaning it does what process schedulers do: Serves a request within a specific
duration, stops, switches to another one, and repeats.
When a process submits a request for disk access, the request can be classified as synchronous or asynchronous. In the case of synchronous
requests, the process waits for the request’s completion; for asynchronous requests, it simply sends the request to disk and starts
doing some other work. Hence, the CFQ scheduler gives more time/priority to synchronous requests rather than to asynchronous
requests. CFQ gives the best balance (theoretically) between throughput and interactivity.

[REF] I/O Schedulers Explained

I/O SCHEDULERS
I am sharing the work of XDA member @droidphile
Here each & every concept of I/O Sched. is very clearly explained.
Q. "What purposes does an i/o scheduler serve?"
A. Minimize hard disk seek latency.
Prioritize I/O requests from processes.
Allocate disk bandwidth for running processes.
Guarantee that certain requests will be served before a deadline.
So in the simplest of simplest form: Kernel controls the disk access using I/O Scheduler.
Q. "What goals every I/O scheduler tries to balance?"
A. Fairness (let every process have its share of the access to disk)
Performance (try to serve requests close to current disk head position first, because seeking there is fastest)
Real-time (guarantee that a request is serviced in a given time)
Description, advantages, disadvantages of each I/O Scheduler?
List of I/O Schedulers:-
1) Noop
2) Deadline
3) CFQ
4) BFQ
5) SIO
6) V(R)
7) Anticipatory
1) Noop
Inserts all the incoming I/O requests to a First In First Out queue and implements request merging.
Best used with storage devices that does not depend on mechanical movement to access data (yes, like our flash drives).
Advantage here is that flash drives does not
require reordering of multiple I/O requests unlike in normal hard drives.
Advantages:
Serves I/O requests with least number of cpu cycles.
(Battery friendly?)
Best for flash drives since there is no seeking penalty.
Good throughput on db systems.
Disadvantages:
Reduction in number of cpu cycles used is proportional
to drop in performance.
2) Deadline
Goal is to minimize I/O latency or starvation of a request.
The same is achieved by round robin policy to be fair
among multiple I/O requests. Five queues are
aggressively used to reorder incoming requests.
Advantages:
Nearly a real time scheduler.
Excels in reducing latency of any given single I/O.
Best scheduler for database access and queries.
Bandwidth requirement of a process - what percentage of
CPU it needs, is easily calculated.
Like noop, a good scheduler for solid state/flash drives.
Disadvantages:
When system is overloaded, set of processes that may miss deadline is largely unpredictable.
3) CFQ
Completely Fair Queuing scheduler maintains a scalable per-process I/O queue and attempts to distribute the available I/O bandwidth equally among all I/O requests.
Each per-process queue contains synchronous requests from processes.
Time slice allocated for each queue
depends on the priority of the 'parent' process.
V2 of CFQ has some fixes which solves process' i/o starvation and some small backward seeks in the hope of improving responsiveness.
Advantages:
Considered to deliver a balanced i/o performance.
Easiest to tune.
Excels on multiprocessor systems.
Best database system performance after deadline.
Disadvantages:
Some users report media scanning takes longest to complete using CFQ.
This could be because of the property that since the bandwidth is equally distributed
to all i/o operations during boot-up, media scanning is not given any special priority.
Jitter (worst-case-delay) exhibited can sometimes be high, because of the number of tasks competing for the disk.
4) BFQ
Instead of time slices allocation by CFQ, BFQ assigns budgets.
Disk is granted to an active process until it's
budget (number of sectors) expires.
BFQ assigns high budgets to non-read tasks.
Budget assigned to a process varies over time as a function of it's behavior.
Advantages:
Believed to be very good for usb data transfer rate.
Believed to be the best scheduler for HD video recording and video streaming. (because of less jitter as compared to CFQ and others)
Considered an accurate i/o scheduler.
Achieves about 30% more throughput than CFQ on most workloads.
Disadvantages:
Not the best scheduler for benchmarking.
Higher budget assigned to a process can affect interactivity and increased latency.
5) SIO
Simple I/O scheduler aims to keep minimum overhead to achieve low latency to serve I/O requests.
No priority queues concepts, but only basic merging.
Sio is a mix between noop & deadline. No reordering or sorting of requests.
Advantages:
Simple, so reliable.
Minimized starvation of requests.
Disadvantages:
Slow random-read speeds on flash drives, compared to other schedulers.
Sequential-read speeds on flash drives also not so good.
6) V(R)
Unlike other schedulers, synchronous and asynchronous requests are not treated separately, instead a deadline is imposed for fairness.
The next request to be served is
based on it's distance from last request.
Advantages:
May be best for benchmarking because at the peak of it's 'form' VR performs best.
Disadvantages:
Performance fluctuation results in below-average performance at times.
Least reliable/most unstable.
7) Anticipatory
Based on two facts
i) Disk seeks are really slow.
ii) Write operations can happen whenever, but there is always some process waiting for read operation.
So anticipatory prioritize read operations over write.
It anticipates synchronous read operations.
Advantages:
Read requests from processes are never starved.
As good as noop for read-performance on flash drives.
Disadvantages:
'Guess works' might not be always reliable.
Reduced write-performance on high performance disks.
Frequently asked questions
Q. "Best I/O Scheduler?"
A. There is nothing called "best" i/o scheduler. Depending
on your usage environment and tasks/apps been run,
use different schedulers. That's the best i can suggest.
However, considering the overall performance, battery,
reliability and low latency, it is believed that
SIO > Noop > Deadline > VR > BFQ > CFQ, given all
schedulers are tweaked and the storage used is a flash
device.
Q. "How do i change I/O schedulers?"
A.Voltage Control or No Frills from market.
Or init.d script:
echo "scheduler-name" > /sys/block/mmcblk0/queue/
scheduler
------------------------------------++END++---------------------------------------
RISK EVERYTHING
Press Thanks :thumbup: If I Helped
SENIOR MEMBER
NEWBIE DEVELOPER
LEARNING THE ART OF DEVELOPING KERNELS
PHONE : SAMSUNG GT I8262, SAMSUNG GT S5360
Feel free to ask any queries....
RISK EVERYTHING
Press Thanks :thumbup: If I Helped
SENIOR MEMBER
NEWBIE DEVELOPER
LEARNING THE ART OF DEVELOPING KERNELS
PHONE : SAMSUNG GT I8262, SAMSUNG GT S5360

Nameless i8260/i8262 kernel

This particular kernel contains changes to the following:
- binder bugs, i.e. leaks, API misuse
- lowmem killer logic errors
- scheduler, i.e..spurious wakeups, "bouncing cow", fair scoring
- vm subsystem changes to oom killing, google lowmemkiller
- kswapd wasting CPU time no longer occurs
- cpufreq microoptimizations (wakeups, useless computation), interactive governor updated to latest version from msm-kernel for 3.10 Google Wear
Credits:
Kernel forked from work of another xda member. That's documented in github project itself, and revision history.
Changes come from Torvalds tree, msm and common. The kswapd fix comes from a google search. You can look for "contention_wait" yourself to note the source.
hxxps://github.com/sthalik/gcore_kernel
Pull requests and forks welcome. So are quality well-researched bug reports. Feature requests, only if sensible and educated.
-foo
foobie-bletch said:
This particular kernel contains changes to the following:
- binder bugs, i.e. leaks, API misuse
- lowmem killer logic errors
- scheduler, i.e..spurious wakeups, "bouncing cow", fair scoring
- vm subsystem changes to oom killing, google lowmemkiller
- kswapd wasting CPU time no longer occurs
- cpufreq microoptimizations (wakeups, useless computation), interactive governor updated to latest version from msm-kernel for 3.10 Google Wear
Credits:
Kernel forked from work of another xda member. That's documented in github project itself, and revision history.
Changes come from Torvalds tree, msm and common. The kswapd fix comes from a google search. You can look for "contention_wait" yourself to note the source.
hxxps://github.com/sthalik/gcore_kernel
Pull requests and forks welcome. So are quality well-researched bug reports. Feature requests, only if sensible and educated.
-foo
Click to expand...
Click to collapse
Hi there! I would love to try it, how could I?
First post includes a link to the sources. Given an ARM cross-compiler that can build the kernel, it's a matter of repacking initrd and flashing.
Unless you suffer from the kswapd issue, there's little point. Fixes included aren't something you'd notice after using the software briefly.
My intention is to make available the changes. Whether they're given attention or are reviewed at all, doesn't depend on me really.
-foo
foobie-bletch said:
First post includes a link to the sources. Given an ARM cross-compiler that can build the kernel, it's a matter of repacking initrd and flashing.
Unless you suffer from the kswapd issue, there's little point. Fixes included aren't something you'd notice after using the software briefly.
My intention is to make available the changes. Whether they're given attention or are reviewed at all, doesn't depend on me really.
-foo
Click to expand...
Click to collapse
Thanks a lot for your answer, I would love to try it, but i don´t know how to compile a kernel
Contact Ali filth may be he could help.
Sent from my GT-I8262 using XDA Premium 4 mobile app
Please note, you don't have to fork the repository on github to follow the changes.
If you in fact never compile kernels yourself you're not my intended audience.
Still, getting to know C is always the first step toward any serious Linux/Unix hacking.
Kernel stuff isn't any different than others. There are some rules to follow, but this is true of userland code, too. Documentation often says "don't do this and that". Just like with kernel API.

[GUIDE][Kernel] Comprehensive Guide to Kernels. [UPDATE:21.12.16]

If I answer the question of "what is a kernel" it wouldn't tell you much, besides there are enough other threads on XDA and other websites to answer this question.
The best question is "Why to use a custom Kernel?", which answers not only what it is, but also what it can do.
I like the way its explained here:
http://www.makeuseof.com/tag/consider-using-custom-android-kernel/
The next most important thing you need besides the custom kernel is an app to manage it.
Yes, you can change the code directly, but for most non-nerds an app tends to be best, providing a nice GUI to facilitate tuning.
And since I am aiming for this guide to be N00b proof, I am gonna provide as much information as possible.
There aren't many apps which give you control over all features of the kernel and, personally, I hate having to download multiple apps to control every feature of the kernel.
So these are my top 3 recommendations:
The original app from the kernel's dev. You know, the one made specifically for use with that Kernel?
Device Control [root] by Alexander Martinz (Not gonna explain why, just go and test it for yourself or at least look at the play store page)
Kernel Adiutor by Willi Ye (It has a nice material GUI, + Extra features such as tweaking low memory killer, sysctl & sysfs)
What I most found lacking in other kernel guides was a well organised and comprehensive list of things custom kernels can offer. And since there is so much a Kernel could offer I'm going to try to provide it in categories with a couple examples so you get a good idea.
If I there is anything not accounted for, you are welcome to reply to this post and I will be checking every day to expand with any new info.
So without any further ado:
Feature List
General Settings:
These are things which do not fall within any of the other categories to follow. They are things which are usually classed separately in the App used to control the kernel. Examples include but are not limited to Fast Charge, Gesture (Knock on, Swipe2Wake), Color Calibration, Vibration Strength.​
Advanced Settings:
These are similar to the general settings, but as the name suggests they are a bit more advanced and require a bit more knowledge/research to use effectively.
This includes Entropy (if you have no idea what this is look for Seeder App. The description of the App explains this very well.), Voltage Control (Ever heard of UnderVolting?), TCP Congestion Control (As a Networking Student I had no trouble understanding the technical documents about this, but knowing many who will be reading aren't knowledgeable of technical jargon I have included a nice link.)
http://androidmodguide.blogspot.co.uk/p/tcp-algorithms.html
As I know that there will probably be things I'm missing here, if you find anything which I have not explained, a quick google might be very helpful. Otherwise you are welcome to post a reply to this thread (even including the results of your Google if you need someone to explain it to you in a simple way.)
UPDATE 21/12/16: After getting my new HTC 10 I begun doing some research to understand the big.LITTLE configuration. It turns out that there are in fact some tweakable tunables for this. I won't be providing any recommended settings, since currently I am using a modded PnP which dynamically manages Kernel tunables for me, and as far as I know this is a feature unique to HTC.
But for those interested in finding out more here is a guide you could look through, if you want to learn more. The tunables are at the very end.
https://android.googlesource.com/ke...llow-dr/Documentation/scheduler/sched-hmp.txt​
CPU Settings:
This is what you're most likely here for, this is the home of Over (and Under) Clocking.
But it also provides other very useful settings which might not look so simple at first. Here you can select a CPU governor (No guys, I will not list and explain what each one is, there are just too many and too many with stupid names. Instead I will leave you guys with a link to another guide specific about CPU Govs.)
http://androidmodguide.blogspot.co.uk/p/blog-page.html
While we're still talking about CPU Governors, there is a further option that you have if your app supports it. You can tune the specific tunables for each specific Governor, to get the best result possible and most suited to you. Whether you want more performance or battery savings from that specific governor.
Here you can also find toggles for HotPlugging or its counter part CPUquiet (Available only for NVIDIA CPUs I believe.) Hotplugging is simply the technology which decides when and which cores to turn off. CPUquiet is similar but rather than turning off the cores it simply makes the idle. The advantage is debated but the possibility is still there.​
GPU Settings:
This one doesn't have many features (That I know of), it allows you to Over/UnderClock your GPU and also change its Governor.​
Memory Settings:
(EDIT: I have included a Memory settings after doing a bit more of research about it, since its slightly more complicated compared to the other settings. Although most of these settings are available in both custom or stock kernels they can be tweaked to experience performance and battery improvements. So I'll try to cover as much as I can.)
Here you can tweak anything related to RAM and Cache. For tweaking these settings I suggest using the app Kernel Adiutor which I recommended earlier.
Things which you can find in all kernels are Low Memory Killer (Out of memory killer function on Android.) There is no need for me to explain it, what it does is self explanatory, to better understand the tunables I will provide this link:
http://forum.xda-developers.com/showthread.php?t=622666
You can also find tunables for Virtual Memory (Caching parameters), which is part of "sysctl" in the kernel. Tweaking this improves cache management, helping improve load times of cached apps, battery saving by emptying cache less often etc...
Here is a link which will give you a description for each parameter: https://www.kernel.org/doc/Documentation/sysctl/vm.txt
But there are also things which are not active or part of all kernels. zRAM is part of stock, and some custom kernels disable it. While KSM (Kernel Samepage Merging) can be added by some customs.
zRAM is just compressed RAM space. So you can store more in RAM by compressing the data you can fit more data inside your RAM.
Now obviously it is slower than actual normal RAM (since you have to encrypt and decrypt the data), but apparently it still is faster than using swap (which is in your internal memory rather than RAM). The principle works based on that Android prefers to keep data stored as much as possible in RAM to keep recently used apps running quickly. The more you use an app the more priority it has, therefore will stay in normal RAM, things you use sometimes but not very often are kept in zRAM (regardless of how full your actual RAM is), but since you don't use this very often you don't notice the performance hiccup of decrypting that data.
Then last case scenario things you barely use are kept in swap.
For you IT enthusiasts you should have realised already that "z" is the technology prefix for Compression. So it shouldn't come as a surprise that zRAM is compressed RAM.
KSM (Kernel Samepage Merging), this is simple, but it requires knowledge of some terminology. I will try to explain as simple as possible.
It allows the system to merge/share identical memory pages in RAM from different Applications/Processes. Thus it frees up RAM memory.
The only drawback to this is that it's up to your CPU to perform this task, therefore while it will increase performance it will also use up battery. But this is negligibly small (In my experience).
Therefore my recommendation is that if your Kernel offers this keep it turned on.​
File System Settings:
The most desired setting available here is I/O schedulers. Again, I will not specify each scheduler since there are enough guides on the interbebs to give you all the info you need. On the other hand, I will leave you with my favourite of those guides.
http://androidmodguide.blogspot.co.uk/p/io-schedulers.html
The next most interesting settings is Read Ahead Buffer, this simply lets you choose how much data to load the buffer cache with. According to most benchmarks/tests the best value for this is 3 mb aka 3072 kb. This link gives you a better idea of it: https://broodplank.net/?p=788​
Thermal Driver:
Here you can find toggles to manage overheating of the CPU and GPU. An example of which is MSM-Thermal and Core Control. I'm not gonna go into detail about these, since they are pretty self explanatory, and in my experience they both had descriptions beneath the toggles.
The most important thing to keep note of here is that only one should be on at any given time. If you turn 2 or more of these on together it may give you some issues. (It did with me.)​
Tips & Recommendations
This is where as usual the writer gets to voice his opinion
Don't hate if you don't agree, just reply with your own opinion!!
I believe that any good custom Kernel should consistently provide some common settings.
We could say the minimum required to be considered a good custom Kernel.
Here is my list of basics:
General Settings:
Knock On (AKA double tap to wake)
Fast Charge
Advanced Settings:
Entropy
TCP Congestion Control
CPU Settings, all of it.
File System Settings, all of it.
Also my recommendation and tips for ideal CPU tuning and I/O schedulers.
FIrstly, CPU governors can be tuned to improve performance or battery saving. I found a good guide which explains the tunables:
http://forum.xda-developers.com/galaxy-s2/general/ref-kernel-governors-modules-o-t1369817
My recommendations will not take into account all the possible governors, but obviously if you take into account my recommendations and swap my choice of governor for an improved version of the same, or a similar one, then it should be even better.
While regarding the I/O schedulers, they are extremely under documented in comparison to CPU governors. And I have not managed to find a guide on how to best tune the tunables for the schedulers, so I will not cover this. If any one reading has any idea about this, please feel free to share your knowledge with us lowly humans!!
Actual testing reports and comparisons among schedulers are extremely difficult to find. So I will only recommend ones which I have found enough articles for or ones which I have tested myself.
Now for my list of recommendations:
Ideal CPU Governor
For general use, with a battery saving focus I would recommend the Conservative governor. And if you need a bit more of performance then it can be tuned to provide such.
For performance I would use Wheatley. If unavailable, then Elemental X or Interactive will be fine.
N/B: I added wheatley as an update after using it for a couple months, it has a double focus on both performance and battery saving. It follows the idea of "race to idle", that since idle saves the most battery then dealing with processes quicker means more time spent in idle. Therefore it will scale up to higher frequencies than ondemand and interactive, and it will try to deal with all processes in as quick a time as possible.
But it also focuses on battery, and if a process queue is taking long it will resort to scaling down the frequency to save battery while still getting work done.
In my experience I have not felt it glitch, and its very stable. It has improved my battery life (not as much as conservative), but it also has allowed me to use my device at full power.
But as with anything, there's always a downfall, which for wheatley is that it is a rare governor to find in most kernels. Currently I only have it on skydragon kernel. Most other kernels do not feature this governor.
EDIT 29/02/2016: I have learned of a new way to tune the parameters for Interactive governor, for optimum efficiency, when wheatley governor is unavailable. Since Interactive is always available - it is one of the stock governors.
In short it is tuning the parameters to use and spend more time in efficient frequency steps, in order to save battery while keeping the performance as high as possible. Using the fastest frequency steps before a huge jump in voltage consumption.
The links which helped me do it are the following:
http://forum.xda-developers.com/showthread.php?t=2769899
https://vjnaik.wordpress.com/2015/06/25/kernel-tweak-interactive-governor-paramaters-rooted-phone/
Ideal I/O Scheduler
For general use of your phone or tablet I would recommend using ZEN. It can provide good performance and better than average multitasking while having an average battery consumption. Being considerably better than ROW while at only slightly more battery intensive.
Obviously ROW is second choice, but if both of the above are unavailable, then B] FIOPS[/B] is a good replacement, ensuring an above average visual experience, good battery saving, at the expense of multitasking capabilities.
If battery isn't an issue, or you stream a lot of videos, then BFQ appears to provide similar experience to FIOPS plus excellent multitasking, at the expense of battery.
For Gaming, this was hard to find since there weren't any specific articles focusing on this, but from the descriptions and certain comments it appears that SIO provides a good experience. Others mentioned BFQ since it reduces lag.
For gaming you should absolutely avoid ROW and FIOPS since both have reported to increase lag during gaming.
For best battery saving the recommendation is definitely FIOPS. While it isn't the most battery saving scheduler (Noop is), it will provide the most battery saving while also efficiently giving you a great user experience.
For general multitasking the best one is BFQ. It will provide the best transfer rates (aka copy paste and install kind of thing), best for streaming & watching HD videos, and great for keeping loads of apps open at the same time.
N/B: I added ZEN to the list after using it for a couple months. At the time I first released this guide I could not find a kernel which offered this scheduler to test it. But after a while it started becoming more popular, and now it is easily accessible through most major kernels.
In my experience with it it has improved my multitasking slightly, while also reducing lag on general use. Battery increase unnoticeable.
Virtual Memory tuning
This one is a bit more complicated, and I have heard a whole bunch of stuff... Which is why I decided to test it myself and then come back to give you guys a report for it. The effects of VM tuning are not obvious at first glance and but affects the overall feel of the device. (Whether it feels like new, or sluggish etc...)
The main tunables you need to worry about are: Dirty Ratio, Dirty Background Ratio, Overcommit Ratio and Swappiness.
The guide I added above under "Memory Settings" will explain what each of these are.
Dirty Ratio & Dirty Background Ratio - Most people say that these need to be high, so that more stuff is stored in Cache. This will make your phone quick. Because cache is quick. But in reality this is only good advice if all you need to load on your phone is the system UI. Because as soon as you start loading different apps this cache fills quickly, and whenever you want to open an app/file/webpage that is not in cache, your CPU is tasked with both emptying whatever is filling up cache memory and load your new app into cache. Thus making multitasking a nightmare within the first day. A simple reboot of the phone is not enough, nor is clearing RAM (Note: Cache is not RAM).
Often the only solution to speed up your device is to Wipe Cache and Dalvik Cache from recovery every day. And for people with 150+ Apps installed which need to be optimized on boot, this means a lot of time is wasted.
My personal recommendation is to keep Dirty Ratio at around 40, which is double the stock value. Thus you have enough room before your phone freezes to free up cache. While Dirty Background Ration at 10, so that in the background without freezing the app you're currently in the kernel is constantly clearing cache. Allowing enough space for whatever you need to load.
Overcommit Ratio - While increasing allows more multitasking, I recommend leaving this at 0. It keeps RAM from completely filling up, thus avoiding "app xxx not responding" issues.
Swappiness - You have three kinds of fast memory on your phone, from quickest to slowest: Cache, RAM, Swap.
Swap is the last resort for your phone's memory. It is usually used when your RAM is nearly full. Swap is used for app data which is not currently being used, but part of the group of apps you use the most. (This is related to the Low memory killer, so for more information check that link. )
Since app data stored in Swap is stuff you don't use often it doesn't affect your phone greatly. But the more data kept in RAM, rather than Swap, the better.
Therefore after loads of try and testing I found that 40 is the perfect sweet spot. Allowing higher performance while keeping some data rather than completely deleting it when RAM is full.
This is my Guide to Kernels, if you find that it has helped you and would like to thank me remember to press thanks.
If you have any questions please do ask them, I'll answer the best I can.
If you would like to add more, dispute any of the things I said, give extra info on any specific thing which you believe deserves a more thorough breakdown, then go ahead, fell free to comment below.
Thank you for reading this Guide.
Nice guide and thanks for linking to my website
gsstudios
gsstudios said:
Nice guide and thanks for linking to my website
gsstudios
Click to expand...
Click to collapse
It was a pleasure, you have one of the most well informed and well organised guides to the stuff I could find.
Most others are just all over the place.
Keep blogging!
Very useful guide
Just a question: would it be possible gathering info about the "power suspend mode" that is often found in Kernel Adiutor?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
What are the differences among the available options?
Thanks again for your guide
luke! said:
Very useful guide
Just a question: would it be possible gathering info about the "power suspend mode" that is often found in Kernel Adiutor?
What are the differences among the available options?
Thanks again for your guide
Click to expand...
Click to collapse
It took me ages to research, because initially when I did I found nothing. Whenever I searched this I would only find stuff about wakelocks. The wakelock system is more important to developers than actual users, so it was of no use to me.
But after a bit of research I THINK I found the original source code for this feature...I will put a couple links at the bottom for the enthusiasts to see.
(N.B. I will keep researching as I get more time to see if I can find more info on this, because it puzzles me also.)
Before I explain anything you must understand what the suspend state is, usually it is called sleep.
I usually cba to explain anything...since I am awful at explaining stuff in written form...I usually like to explain verbally. So I will leave you with a couple links:
Power suspend in Linux - http://unix.stackexchange.com/questions/162886/what-does-pm-suspend-hybrid-do
Power suspend in Android - http://bamboopuppy.com/android-suspend-a-brief-overview/
How it interacts with the hardware - https://source.android.com/devices/sensors/suspend-mode.html
Now for this kernel feature... I seems from what I have read that it is not activating or deactivating suspend mode....instead it is simply deciding on what "metric" to use.
Generally you could say that suspend state would be achieved on request by the kernel. But what if you want to automate the process so that it uses less requests, and thus goes to sleep quicker and more efficiently?
You make it so it bases on something else's output in order to initiate the count down.
This could be screen on/off (LCD panel), idle time (autosleep function), hybrid (autosleep & LCD panel whichever comes first), or userspace (defined by user.)
In all honesty, how it all works in detail I have no idea. But that is the basic idea.
I also have no idea why it keeps locking to userspace, as if it was default.
It seems that this function is not fully functional yet, or maybe it needs some fixing.
The gerrit page for the source code says that this project was abandoned by the main devs.
Gerrit page - https://gerrit.omnirom.org/#/c/9137/2
In summary, from other things I have read they say that Hybrid is the best one for battery life. But for me it never stays on Hybrid, it keeps resetting to userspace. Therefore I am unable to give you any further information about this.
I hope I helped.
Thank you, thank you, thank you, for putting this up so organized, the only problem on xda is proper guides, I can understand how much time and energy you have put into finding and putting up this guide, and the best part you have given links to the original author and not just copied their hard work and spread their knowledge combined. Well Done mate. That's a real example of how member of xda should be. this will help a lot of people. will share links to this thread.
Edit: added your thread link in my signature, hope you don't mind. I thought it would be better this way for people to see.
luke! said:
Very useful guide
Just a question: would it be possible gathering info about the "power suspend mode" that is often found in Kernel Adiutor?
What are the differences among the available options?
Thanks again for your guide
Click to expand...
Click to collapse
I have some new info about this, I don't remember specifics of where I got this, but it was in a thread about custom kernels.
A lost of people were asking why the setting was stuck.
And if I remember correctly it seems that this feature is a left-over stub from a failed project, which now has been superseded by Doze on Marshmallow.
It works exactly as I described, with the exception of Userspace, which rather than being defined by user it is defined by app. e.g. when app x says it's time to sleep phone will sleep. The other options are automated, and hybrid is the default option and we as users have no way to change it. It's been this way for a while, idk why Adiutor still has the option available.
Also finally understood fully why wakelocks kept popping up when I searched for this...it's because apps can set wakelocks to prevent the "power suspend" from happening, or even to wake the phone from a "power suspend" in order to not stop the app from running. This would be things like facebook, or other messenger apps which want to have a constant running service.
This created huge battery drains in KK and Lollipop, but now in Marshmallow Doze is a bit tougher to get around. Simple wakelocks won't do anymore.
billysam said:
Thank you, thank you, thank you, for putting this up so organized, the only problem on xda is proper guides, I can understand how much time and energy you have put into finding and putting up this guide, and the best part you have given links to the original author and not just copied their hard work and spread their knowledge combined. Well Done mate. That's a real example of how member of xda should be. this will help a lot of people. will share links to this thread.
Edit: added your thread link in my signature, hope you don't mind. I thought it would be better this way for people to see.
Click to expand...
Click to collapse
It's honestly been a pleasure.
I have been learning even more and soon I will re-update this thread with a lot of new info I have found.
I'm glad you liked this Guide, it did take me time and it's good that it has been recognized. You've made my day
This brings to mind the fact that I have been thinking on a new guide to newcomers into rooting and XDA, just explaining all that which is possible in a short but well organized guide .
Feel free to copy the link and share however you would like, it is honestly a huge help!
Thank you for making this guide, it helped me to understand my device further more
Thanks!
Android小楼阁-QQ群 439637151
来自搭载Android 2.3 GingerBread的华为Y220-T10
hello dude can i get your screenshot your setting on your kernel adiutor for daily, power save, and Gaming
.c.t.r. said:
hello dude can i get your screenshot your setting on your kernel adiutor for daily, power save, and Gaming
Click to expand...
Click to collapse
Unfortunately I don't keep presents.
I change on the fly as needed.
It just works better for testing rather than having specific presets to use, because I am constantly changing the actual values I use, also as apps get updated and their RAM usage increase or decrease, the values are always very fluid for me. I just keep changing until I find a comfortable value.
If there is anything specific you would like to know ask, and I'll advise you accordingly.
Thermal Driver:
Here you can find toggles to manage overheating of the CPU and GPU. An example of which is MSM-Thermal and Core Control. ...
Click to expand...
Click to collapse
Is there a way to manually set a temperature at which the CPU is clocked down to a specific MHz?
For example:
Temperature rises to 38 ° C = CPU clocks not higher than 800Mhz
thanks for this thread bro...
i have zero knowledge about kernel issues
and im so curious about how it work's and what it did
to our mobile phone's. but now i found your thread.
thanks for specific and detailed explanation..
even though i did understand only a little part of it
only the specific settings. I didn't know exactly how to use by changing
the number's of each settings under each codes and how it will
response to the performance of the device ..
i hope i will get it soon.. thanks again for putting this thread
it is very helpful in the likes of me newbie with zero knowledge
but willing to learn and understand how it is..
very big thanks bro...:highfive::good:
heross said:
Thermal Driver:
Here you can find toggles to manage overheating of the CPU and GPU. An example of which is MSM-Thermal and Core Control. ...
Is there a way to manually set a temperature at which the CPU is clocked down to a specific MHz?
For example:
Temperature rises to 38 ° C = CPU clocks not higher than 800Mhz
Click to expand...
Click to collapse
Unfortunately I don't know if that is even possible, you might have to mess with source code and add your own patches.
Good luck finding this out!
If and when you do share the knowledge with the community!
bearthing said:
thanks for this thread bro...
i have zero knowledge about kernel issues
and im so curious about how it work's and what it did
to our mobile phone's. but now i found your thread.
thanks for specific and detailed explanation..
even though i did understand only a little part of it
only the specific settings. I didn't know exactly how to use by changing
the number's of each settings under each codes and how it will
response to the performance of the device ..
i hope i will get it soon.. thanks again for putting this thread
it is very helpful in the likes of me newbie with zero knowledge
but willing to learn and understand how it is..
very big thanks bro...:highfive::good:
Click to expand...
Click to collapse
Dude, it's an absolute pleasure. It's mainly for people like you that I have made this guide.
I was like you too, and i didnt find a straightforward guide to help me out in the beginning...
There was a wealth of information but it was all over the place. A bit here a bit there.
I urge you to keep researching and keep learning. If ever you find that something you need doesn't exist, then make your own research and create that which you needed so that others who follow after you don't have to go through the same struggle!
Kyuubi10 said:
Dude, it's an absolute pleasure. It's mainly for people like you that I have made this guide.
I was like you too, and i didnt find a straightforward guide to help me out in the beginning...
There was a wealth of information but it was all over the place. A bit here a bit there.
I urge you to keep researching and keep learning. If ever you find that something you need doesn't exist, then make your own research and create that which you needed so that others who follow after you don't have to go through the same struggle!
Click to expand...
Click to collapse
some device not supported the tuning like my lg g4 h818p the noop doesn't tunable and cubic? thanks again bro
bearthing said:
some device not supported the tuning like my lg g4 h818p the noop doesn't tunable and cubic? thanks again bro
Click to expand...
Click to collapse
it's not the device, but the Kernel.
If the developer of the kernel adds support for certain features you will be able to use them.
You need to search and find the custom Kernel which has the features you are looking for.
Kyuubi10 said:
it's not the device, but the Kernel.
If the developer of the kernel adds support for certain features you will be able to use them.
You need to search and find the custom Kernel which has the features you are looking for.
Click to expand...
Click to collapse
any kernel is compatible to my g4 h818p? or
i search for specific kernel that compatible to my device?
thanks bro
bearthing said:
any kernel is compatible to my g4 h818p? or
i search for specific kernel that compatible to my device?
thanks bro
Click to expand...
Click to collapse
Find the thread for your device and you'll pretty much have found jackpot
i need help.i use kernel auditor to increase my headphones volume when playing music.( just use hdp slider to increase )
but happens that wen i unplugg the headphones and awnser a call the other persons dont hear me.
what to do?

Crital Kernnel bug in most versions before 4.20.11

Haven't seen mobile specifically mentioned anywhere but given the nature of this, it may very well be. Short version is .. well, everything going back at to least 2.6.10. If it is indeed this bad it would be one of the worst I've ever seen in terms of scope.
https://nvd.nist.gov/vuln/detail/CVE-2019-8912
http://www.securityfocus.com/bid/107063
> In the Linux kernel through 4.20.11, af_alg_release() in crypto/af_alg.c neglects to set a NULL value for a certain structure member, which leads to a use-after-free in sockfs_setattr.
Impact
CVSS v3.0 Severity and Metrics:
Base Score: 9.8 CRITICAL
Vector: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (V3 legend)
Impact Score: 5.9
Exploitability Score: 3.9
Attack Vector (AV): Network
Attack Complexity (AC): Low
Privileges Required (PR): None
User Interaction (UI): None
Scope (S): Unchanged
Confidentiality (C): High
Integrity (I): High
Availability (A): High

Categories

Resources