[Galaxy S II I9100G Android Development] Ryuinferno:
Kernel Features Explained

What is frandom?

v6 and onwards supports frandom, which is a faster (10-50 times) random number generator than urandom...it generally decreases lag in GUI...if you are using CrossBreeder, it will automatically utilise it...if not, place this script in /etc/init.d and set permissions as rwxrwxrwx (name it whatever you want) and reboot:

#!/system/bin/sh
# Ryuinferno @ XDA

chmod 666 /dev/frandom
chmod 666 /dev/erandom
mv /dev/random /dev/random.ori
mv /dev/urandom /dev/urandom.ori
ln /dev/frandom /dev/random
ln /dev/erandom /dev/urandom

It is working if you have /dev/random.ori and /dev/urandom.ori after a reboot...to revert, just remove the script (or else, it will be applied on every boot)...

What is swap?

Swap is, in short, virtual RAM. With swap, a small portion of the hard drive is set aside and used like RAM. The computer will attempt to keep as much information as possible in RAM until the RAM is full. At that point, the computer will begin moving inactive blocks of memory (called pages) to the hard disk, freeing up RAM for active processes. If one of the pages on the hard disk needs to be accessed again, it will be moved back into RAM, and a different inactive page in RAM will be moved onto the hard disk (‘swapped’). The trade off is disks and SD cards are considerably slower than physical RAM, so when something needs to be swapped, there is a noticeable performance hit.

Unlike traditional swap, Android’s Memory Manager kills inactive processes to free up memory. Android signals to the process, then the process will usually write out a small bit of specific information about its state (for example, Google Maps may write out the map view coordinates; Browser might write the URL of the page being viewed) and then the process exits. When you next access that application, it is restarted: the application is loaded from storage, and retrieves the state information that it saved when it last closed. In some applications, this makes it seem as if the application never closed at all. This is not much different from traditional swap, except that Android apps are specially programed to write out very specific information, making Android’s Memory Manager more efficient that swap.

To use swap, the easiest way is to install Swapper2

What is zRAM?

To use zRAM, the easiest way is to install Trickster MOD Kernel Settings

What is exFAT?

Read this: http://www.differencebetween.net/technology/software-technology/difference-between-exfat-and-fat32/#ixzz1k5uLzt4l

Summary:

1.exFAT allows for higher drive capacities than FAT32.

2.exFAT has a larger file size limit than FAT32.

3.exFAT uses a free space bitmap while Fat32 doesn’t.

4.FAT32 has greater support than exFAT.

5.FAT32 doesn’t have file number limits while exFAT does.

What is BLX?

This feature has been developed by Ezekeel and allows to set a customized battery charging limit (100% is the default stock value, if you want, you can set a lower value).

As Ezekeel said, it is commonly accepted that both very low and very high charge states accelerate the degradation of the battery capacity (that is why you should store Li-Ion batteries at around 40% charge).

If you set a charging limit equal to 100, this feature will be disabled.

What is Dynamic Fsync?

This feature has been developed by Faux123 and allows to dynamically manage the synchronous writes performed on file system (FSync).

It uses asynchronous writes when the screen is on, instead of synchronous writes, to have better performance and a slightly lower battery drain, while when the screen is off the synchronous writes are re-enabled to flush all the outstanding writes and prevent possible data loss.

What is Dynamic Dirty Page Writebacks?

This feature has been developed by Christopher83 and allows to dynamically manage the dirty page writebacks with two different intervals, one when the screen is on and another when the screen is off.

It is based on a commit of Francisco Franco, but instead of using hard coded values and of disabling at all the dirty page writebacks while the screen is on (possibility of data loss), I preferred to use a customizable higher dirty page writebacks interval (15 seconds) than the default one (5 seconds) while the screen is on and a customizable default interval (5 seconds) when the screen is off.

By using a higher interval we have better performance and less battery consumption, with a very low risk of data loss.

How to customize the dynamic dirty page writebacks feature (default enabled):

Three new procfs parameters are exposed inside /proc/sys/vm path:

- dynamic_dirty_writeback is the activation status of this feature, set 1 to enable it, set 0 to disable it and use the standard behaviour

- dirty_writeback_active_centisecs is the interval for the dirty page writebacks when the system is active (screen on), the default value is 1500 centisecs (15 seconds)

- dirty_writeback_suspend_centisecs is the interval for the dirty page writebacks when the system is suspended (screen off), the default value is 500 centisecs (5 seconds)

1) By directly editing one of the file written above inside /proc/sys/vm and setting the preferred value (note that set value will be lost after a reboot/shutdown)

2) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)

- Open Terminal Emulator

- Run this command to disable the dynamic dirty page writebacks feature

su
echo 0 > /proc/sys/vm/dynamic_dirty_writeback

- Or run this command to re-enable the dynamic dirty page writebacks feature

su
echo 1 > /proc/sys/vm/dynamic_dirty_writeback

- Run this command to set customize the two intervals (30 seconds while the screen is on, 10 seconds when the screen is off)

su
echo "3000" > /proc/sys/vm/dirty_writeback_active_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_suspend_centisecs

What is timer slack controller and dynamic management of the minimal timer slack value?

The timer slack controller is a feature developed by Kirill Shutemov and it allows to set the minimal timer slack value for every process contained within a control group (cgroup).

A timer slack allows the kernel to manage processes wakeup requests at some future time.

Thanks to this feature, the kernel can set a specific timer slack for the involved processes, minimizing the number of wakeups and allowing a lower system's power consumption.

For further info: Timer slack for slacker developers

Chirstoper83 also implemented a new feature in addition to the above one that allows the dynamic management of the minimal timer slack value.

So, it's possible to use different minimal timer slack value when the system is active and when has been suspended.

How to customize the dynamic timer slack controller feature:

Three new cgroup parameters are exposed inside each processes hierarchy contained in /dev/cpuctl path:

- timer_slack.min_slack_ns is the timer slack used when the system is active for the current processes hierarchy

- timer_slack.min_slack_suspend_ns is the timer slack used when the system is suspended for the current processes hierarchy

- timer_slack.effective_slack_suspend_ns is the timer slack currently used

At the moment, the values chosen and used by Blazing Kernel are the following:

- core processes (/dev/cpuctl), 0 ns when the system is active, 50000 ns when the system is suspended

- foreground apps/processes (/dev/cpuctl/apps), 0 ns when the system is active, 250000 ns when the system is suspended

- background non interactive apps/processes (/dev/cpuctl/apps/bg_non_interactive), 100000000 ns when the system is active, 250000000 ns when the system is suspended

1) By directly editing one of the file written above inside /dev/cpuctl and inside each hierarchy subfolder, by setting the preferred value (note that set value will be lost after a reboot/shutdown)

2) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)

- Open Terminal Emulator

- Run these commands to set the minimal timer slack for generic and core apps/processes

su
echo 0 > /dev/cpuctl/timer_slack.min_slack_ns
echo 50000 > /dev/cpuctl/timer_slack.min_slack_suspend_ns

- Run these commands to set the minimal timer slack for apps/processes in foreground

su
echo 0 > /dev/cpuctl/apps/timer_slack.min_slack_ns
echo 100000 > /dev/cpuctl/apps/timer_slack.min_slack_suspend_ns

- Run these commands to set the minimal timer slack for apps/processes in background and non interactive

su
echo 100000000 > /dev/cpuctl/apps/bg_non_interactive/timer_slack.min_slack_ns
echo 250000000 > /dev/cpuctl/apps/bg_non_interactive/timer_slack.min_slack_suspend_ns

What are CK3 tweaks?

They are actually patches by Con Kolivas (author of BFQ scheduler), more info in commit message here: https://github.com/Ryuinferno/Blazing_Kernel_t1/commit/3fa18eb9feee1c204b20a63f16136dc2b066581d