FORUMS

[KERNEL][3.4.74][KK][PMEM] K^Kernel 3.4.74 v1.1 for KK 4.4 [12/12/2013][EOL]

1,446 posts
Thanks Meter: 12,843
 
By Christopher83, Inactive Recognized Developer on 25th November 2013, 10:38 PM
Post Reply Email Thread
Announcement from Christopher83: Customized kernel 3.4.x for KitKat 4.4 rom (CM 11 and derivatives)


In this thread you may find my customized kernel 3.4.x for KitKat rom (CM 11 and derivatives) that use PMEM memory allocations.
Of course, your feedback, as always, are welcome and certainly valuable.


The main features are the following:
- Kernel 3.4.x
- Sources synched with cm-11.0 repo branch of DevCon Team
- Built with my custom Linaro 4.8.3-2013.11 toolchain optimized for Cortex-A8
- Built with Cortex-A8 and NEON VFP optimization flags (both kernel and modules)
- Built with -O3 optimization flag (both kernel and modules)
- CPU overclockable up to 1824 MHz
- CPU frequencies undervolted (UV version) or extremely undervolted (EXUV version)
- CPU voltage control VDD sys interface (click for more details)
- 360MB, 370MB or 390MB of free RAM
- Init.d support
- Fast Charge support (default disabled, click for more details)
- Battery Life eXtender support (default disabled, click for more details)
- Ram Console support (click for more details)
- Backlight Notification v9 (BLNv9) (click for more details)
- USB OTG support (if also implemented on rom side)
- Customizable vibration intensity (click for more details)
- Lowered display panel voltage
- Lowered touchscreen voltage
- Lowered wifi voltage
- Lowered swappiness (60 -> 45)
- Increased CPU frequency during boot
- Optimized AES and SHA1 routines for ARM cpu architecture
- Fixed 100% battery notification after charger unplug
- Increased audio volume on board side
- Con Kolivas' CK3 Tweaks
- Optimized SLUB memory allocator
- Optimized ARM RWSEM (read/write semaphore) algorithm
- Optimized asynchronous I/O latency on solid state disks
- Disabled Gentle Fair Sleepers for better UI performance
- Filesystem dynamic read-ahead (based on disk size)
- CIFS support on boot
- Memory compaction
- Dynamic compression of clean pagecache pages
- Fast Random generator (frandom) support (click for more details)
- New display drivers from Samsung Galaxy SII
- Updated light sensor driver and display driver light sensor changes
- Updated sensor drivers
- Phantom key presses filter (click for more details)
- Dynamic FSync v1.2 (click for more details)
- Dynamic dirty page writebacks (click for more details)
- VM tweaks for performance and less battery consumption
- Revised LowMemoryKiller parameters for better performance (click for more details)
- Customizable timeout for touchkeys backlight after a key press or touchscreen press (click for more details)
- Customizable activation status of touchkeys backlight on touchscreen press (click for more details)
- Timer slack controller (click for more details)
- Dynamic management of the minimal timer slack value during suspend/resume (click for more details)
- LowMemoryKiller management of not killable processes (click for more details)
- exFAT support
- Additional TCP Congestion algorithms

Available CPU governors:
- Adaptive
- BrazilianWax
- Conservative
- Hyper
- Intellidemand
- Interactive
- InteractiveX
- LionHeart
- LulzActive
- OnDemand (default)
- OnDemandX
- Performance
- Powersave
- SmartAssV2

Available I/O schedulers:
- BFQ
- CFQ
- Deadline
- Fiops
- Noop
- ROW
- SIO (default)
- V(R)


Kernel Downloads for KitKat:



Howto install the kernel:
1) Download the preferred kernel zip file to sdcard or external sdcard
2) Reboot to recovery mode
3) Flash the kernel zip file
4) Wipe cache and dalvik cache
5) Reboot the system



Kernel sources (on GitHub):



Useful info:
- Special features and sysfs settings
- Frequently asked questions


Rom and kernel 3.4.x known problems:
- For the builds with 390MB of free RAM, the camera works and the video recording works only in 480p mode



Tables:







Changelog:
Code:
12/12/2013 - K^Kernel 3.4 v1.1 for KitKat
- Kernel 3.4.74
- Sources synched with cm-11.0 repo branches of DevCon Team
- Built with my latest custom Linaro 4.8.3-2013.11 toolchain optimized for Cortex-A8
- crypto: msm: Check destination buffer write access (credits to Mona Hossain)
- crypto: msm: Check for invalid byte offset field (credits to Mona Hossain)
- crypto: msm: Fix issues related to non-zero byteoffset input (credits to AnilKumar Chimata)
- crypto: msm: Fix null pointer exception in qcrypto_count_sg() (credits to AnilKumar Chimata)
- crypto: msm: Use scnprintf() instead of snprintf() (credits to AnilKumar Chimata)
- Ramdisk fixes

24/11/2013 - K^Kernel 3.4 v1.0 for KitKat
- Initial release
- Kernel 3.4.70
- Sources synched with cm-11.0 repo branches of DevCon Team
- Built with my latest custom Linaro 4.8.3-2013.11 toolchain optimized for Cortex-A8
- msm: kgsl: Avoid turning on GPU clock if already off (credits to Ananta Kishore K)
- Update defconfigs to enable some netfilter options (credits to Christopher83)
- Revert "ALSA: fix oops in snd_pcm_info() caused by ASoC DPCM" (credits to Christopher83)
- Update default and custom defconfigs for additional TCP Congestion algorithms (credits to Christopher83)
- Add exfat support (credits to radu)
- Update default and custom defconfigs for exFat support (credits to Christopher83)
- msm: vidc: Reset stop_called state when START is called (credits to Deepak Verma)
- msm: vidc: set EOS on output buffer pending transaction (credits to Deepak Verma)
- Clone ion.h to msm_ion.h (credits to Arco68)
- acpuclock-7x30: Raised some standard UV and stock voltages for high OC cpu frequencies (credits to Christopher83)
- Add extra free kbytes tunable (credits to Rik van Riel)
- input: Updates to Phantom Key Presses filter (credits to Christopher83)
- SELinux: include definition of new capabilities (credits to Eric Paris)
- msm: vidc: Check validity of userspace address (credits to Deepak Verma)
- ALSA: pcm: check for integer overflow during multiplication (credits to Phani Kumar Uppalapati)
- base: genlock: Zero a structure before sending it to user space (credits to Jordan Crouse)
- softirq: reduce latencies (credits to Eric Dumazet)
- fs: vfat: reduce the worst case latencies (credits to xiaogang)
- jiffies conversions: Use compile time constants when possible (credits to Joe Perches)
- qt602240_ts: updated touchscreen driver in according of Multi-touch protocol (credits to CastagnaIT)



Credits and Thanks to:
Arco68, CastagnaIT and Ivendor for their awesome work and their kernel sources
Ezekeel, Doomlord, Faux123, Stratosk, Tegrak, ErasmuX, Imoseyon and other devs I'm surely missing
CyanogenMod, Kernel.org, Code Aurora Forum, Google, Linaro GCC developers
KTulu84, Smeroni68, XeLLaR* for their support in testing
Sament83, B1tt1, Dellup, Pierm, Leonbeson, Cippoz89 and Marco Z. for their donations

XDA:DevDB Information
[GT-I9001][PMEM] K^Kernel 3.4 for KK 4.4, Kernel for the Samsung Galaxy S I9000

Contributors
Christopher83
Kernel Special Features: Customized kernel 3.4.x for JB 4.2.2 and JB 4.3 rom (CM 10.1, CM 10.2 and derivatives)

Version Information
Status: Stable
Current Stable Version: v1.1
Stable Release Date: 2013-12-12

Created 2013-11-25
Last Updated 2015-06-08
Attached Thumbnails
Click image for larger version

Name:	K_Kernel_CPU_Voltages.png
Views:	257497
Size:	50.3 KB
ID:	2415561   Click image for larger version

Name:	K^Kernel_3.4.x_KitKat_QR_Code.png
Views:	14640
Size:	379 Bytes
ID:	2415565   Click image for larger version

Name:	K_Kernel_3.4_Memory.png
Views:	19212
Size:	38.9 KB
ID:	2415569   Click image for larger version

Name:	K^Kernel_3.4.x_KitKat.png
Views:	21715
Size:	39.7 KB
ID:	2415606  
The Following 52 Users Say Thank You to Christopher83 For This Useful Post: [ View ] Gift Christopher83 Ad-Free
25th November 2013, 10:39 PM |#2  
Christopher83's Avatar
OP Inactive Recognized Developer
Flag Milan
Thanks Meter: 12,843
 
Donate to Me
More
Special features and sysfs settings (Part 1):

Here you can find some useful scripts that can be used with the following described features:

Phantom Key Presses filter
This feature is an attempt to workaround a well known hardware bug of some Samsung devices.
Pratically, the high activity of the radio hardware, in particular the antenna, could cause interference on Melfas chip, which is located very close to the antenna.
This interference could induce bad interrupts that are seen by the chip as possible HOME, MENU or BACK key presses.
These phantom key presses are happening expecially in 2G mode.

The solution includes a new device module (phantom_kp_filter), which also allows the filtering parameters customization, and various changes to cypress-touchkey and pmic8xxx-keypad modules.
The phantom key presses filtering is enabled by default for incoming MENU and BACK touch keys, because for these keys is simpler to recognize a bad interrupt or an invalid key press, instead it's disabled for incoming HOME key (read the next howto infos to enable it).

I also developed a new app to better manage the filtering status and the filtering parameters customization, you can find it on this thread:

How to enable/disable the feauture and customize the filtering parameters:

The new device module allows to show the number of ignored key presses and to customize the filtering parameters by means of a sysfs interface, at the following system path: /sys/class/misc/phantom_kp_filter

The interface exposes these files:
  • home_enabled: show/edit the enable status of the phantom HOME key presses filtering (0 = disabled and 1 = enabled, disabled by default)
  • home_allowed_irqs: show/edit the allowed max number of incoming interrupts to consider a HOME key press as valid (from 1 to 32, default = 4), a lower value allows to have a more aggressive filtering, instead a higher value allows to have a more permissive filtering
  • home_report_wait: show/edit the wait time in ms before report the collected HOME key presses (from 5 to 25 ms, default = 12 ms), the key presses during this wait time are collected and reported only if the system received a number of interrupts less than or equal to the allowed max number of incoming interrupts (home_allowed_irqs parameter)
  • home_ignored_kp: show the ignored possible phantom HOME key presses
  • menuback_enabled: show/edit the enable status of the phantom MENU and BACK key presses filtering (0 = disabled, 1 = enabled, enabled by default)
  • menuback_interrupt_checks: show/edit the number of interrupt checks to be performed for the incoming MENU and BACK key presses (from 1 to 10, default = 10), a lower value is more permissive, a higher value securely avoids most of the bad interrupts
  • menuback_first_err_wait: show/edit the time in ms to wait after the first error on MENU or BACK keys if there are many invalid key errors in rapid sequence (from 50 to 1000 ms, default = 500 ms), the default value is optimal and well tested
  • menuback_last_err_wait: show/edit the time in ms to wait after the last error on MENU or BACK keys if there are many invalid key errors in rapid sequence (from 50 to 1000 ms, default = 100 ms), the default value is optimal and well tested
  • menuback_ignored_kp: show the ignored possible phantom MENU and BACK key presses
  • version: show the module version


To change the filtering parameters:
1) By downloading and using my new app PkfManager
2) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 05pkf_alt
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred filtering parameters (the downloaded script has the default filtering parameter values and enables the phantom HOME key presses filtering)
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By directly editing the files inside /sys/class/misc/phantom_kp_filter (the values you set will be lost after a reboot/shutdown)
4) By using Terminal Emulator (note that set values will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands
Code:
su
echo value > /sys/class/misc/phantom_kp_filter/parameter_name
where value is the value you want to set and parameter_name is one of the previously described editable parameters

For example, these commands will enable phantom HOME key presses filtering:
Code:
su
echo 1 > /sys/class/misc/phantom_kp_filter/home_enabled
To show the number of ignored key presses (possible phantom key presses):
1) By directly opening the files /sys/class/misc/phantom_kp_filter/home_ignored_kp and /sys/class/misc/phantom_kp_filter/menuback_ignored_kp
2) By using Terminal Emulator
- Open Terminal Emulator
- Run these commands
Code:
su
cat /sys/class/misc/phantom_kp_filter/home_ignored_kp
cat /sys/class/misc/phantom_kp_filter/menuback_ignored_kp

Customizable timeout of touchkeys backlight after press
This feature allows to set a customized timeout of touchkeys backlight after a key press or touchscreen press. The default value is 1600 ms.

How to set the timeout of touchkeys backlight:

1) By using the related setting inside System -> Advanced -> Backlight Timeout
2) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 20backlight_timeout
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred timeout (the downloaded script will set the status to 0 = disabled)
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By directly editing the file /sys/class/misc/notification/bl_timeout (the value you set will be lost after a reboot/shutdown)
4) By using Terminal Emulator (note that set values will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands to set the timeout of touchkeys backlight to 1000 ms (1 second)
Code:
su
echo 1000 > /sys/class/misc/notification/bl_timeout

Customizable activation status of touchkeys backlight on touchscreen press
This feature allows to enable/disable the touchkeys backlight after a touchscreen press.

How to set the status of touchkeys backlight on touchscreen press:

1) By using the related setting inside System -> Advanced -> Backlight on Touchscreen Press
2) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 25touchlight_status
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred status(the downloaded script will set the status to 0 = disabled)
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By directly editing the file /sys/class/misc/notification/touchlight_enabled (the value you set will be lost after a reboot/shutdown)
4) By using Terminal Emulator (note that set values will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands to disable the touchkeys backlight on touchscreen press
Code:
su
echo 0 > /sys/class/misc/notification/touchlight_enabled
- Or run these commands to enable the touchkeys backlight on touchscreen press
Code:
su
echo 1 > /sys/class/misc/notification/touchlight_enabled

CPU voltage control VDD sys interface
This feature allows to customize the voltage assumed by each cpu scaling frequency.
It could be useful if you'd like to decrease one or more voltages for battery saving purposes (undervolting), or to increase/adjust them to prevent phone freezes (overvolting).

How to customize the voltages:

1) By downloading and using Trickster MOD or IncrediControl and changing the voltages table inside the SVS tab
2) By using customized init.d scripts (the custom values will be always restored after a reboot, if you don't format the system partition)
- Download one of the script named 01vdd_levels*
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your customized voltages, where each line has this syntax
Code:
echo "cpu_freq_HZ mV" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
cpu_freq_HZ is the cpu frequency in Hz you'd like to change
mV is the voltage you want to set

For example, the following line means that when the cpu frequency is 1516800 Hz = 1516 MHz, the voltage used will be 1175 mV
Code:
echo "1516800 1175" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By using Terminal Emulator (note that the values you set will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands
Code:
su
# Run a command for each cpu frequency voltage you'd like to change
echo "cpu_freq_HZ mV" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
cpu_freq_HZ is the cpu frequency in Hz you'd like to change
mV is the voltage you want to set

For example, the following line means that when the cpu frequency is 1516800 Hz = 1516 MHz, the voltage used will be 1175 mV
Code:
echo "1516800 1175" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels

Alternative Extreme Undervolted (ExUV) settings
If after overclocking your I9001 you noticed some freezes when on ExUV kernel builds, you may use an alternative extremely undervolted setting with the init.d script you can find here: 01vdd_levels_alt_exuv
- Download the script
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot


Customized vibration intensity
This feature has been developed by CastagnaIT and allows to set a customized vibration intensity (121 is the default stock value).
It could be useful if you don't like the stock vibration intensity and you'd like to have a lower / stronger vibration.
The setting will affect the haptic feedback and the notification vibration intensity.

How to set a customized vibration intensity:

1) By using the related setting inside System->Advanced->Vibration (only on CM 10 Beta 4 and next releases)
2) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 10vibetonz
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred vibration intensity (the downloaded script will set the vibration intensity to 70)
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By directly editing the file /sys/class/vibetonz/immDuty/pwmvalue_intensity (the value you set will be lost after a reboot/shutdown)
4) By using Terminal Emulator (note that set values will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands (changing the intensity value = 70 with the preferred one)
Code:
su
echo 70 > /sys/class/vibetonz/immDuty/pwmvalue_intensity

Backlight Notification V9 (BLNv9)
This feature allows to notify you of missing calls, messages, emails, etc... by lighting up or blinking the Menu and Back buttons.
With BLNv9 enabled you don't need to unlock the screen to see if you have new notifications.

How to configure the BLNv9:

1) By downloading and using BLN Control Free, BLN Control Pro or NsTools
2) By directly editing the file /sys/class/misc/backlightnotification/enabled and setting 1 to enable the feature, 0 to disable it (note that set value will be lost after a reboot/shutdown)
3) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run this command to enable the feature
Code:
su
echo 1 > /sys/class/misc/backlightnotification/enabled
- Run, instead, this command to disable the feature
Code:
su
echo 0 > /sys/class/misc/backlightnotification/enabled
Work in progress (init.d, blinking and other settings)...


Force Fast Charge
This feature allows you to force AC charging for any charger that is detected as USB (eg. PC USB ports, USB Car Chargers) and pull the full current the charger can support, in such a way as to speed up the time required for a complete battery recharge.
By enabling this feature, the USB / ADB data transfers will be disabled (security limitation to protect your data).

How to enable/disable the Force Fast Charge:

1) By using the related setting inside System->Advanced->Force Fast Charge (only on CM 10 Beta 3 and next releases)
2) By downloading and using Trickster MOD or IncrediControl or NsTools
2) By directly editing the file /sys/kernel/fast_charge/force_fast_charge and setting 1 to enable the force charge, 0 to disable it (note that set value will be lost after a reboot/shutdown)
3) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run this command to enable the force fast charge feature
Code:
su
echo 1 > /sys/kernel/fast_charge/force_fast_charge
- Then, when you want to restore the normal status, run this command to disable the force fast charge feature
Code:
su
echo 0 > /sys/kernel/fast_charge/force_fast_charge
4) By using a customized init.d script, but I don't recommend it because you have to remember to disable the feature every time you want to connect your device to a pc for data transfering after every reboot

Battery life extender (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.

How to activate this feature and set a customized charging limit:

1) By downloading and using Trickster MOD or NsTools by setting the customized battery life extender charging limit
2) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 15blx
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred charging limit (the downloaded script will set the charging limit to 95%)
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By directly editing the file /sys/class/misc/batterylifeextender/charging_limit (the value you set will be lost after a reboot/shutdown)
4) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands (changing the charging limit = 95 with the preferred one)
Code:
su
echo 95 > /sys/class/misc/batterylifeextender/charging_limit

LowMemoryKiller
The LowMemoryKiller driver is used to kill a selected process and free the memory when it is under one of the defined thresholds.
The tuning of the driver could be achieved by means of two parameters exposed by the kernel module via sysfs interface:

- /sys/module/lowmemorykiller/parameters/minfree
This file includes a comma separated array of the threshold numbers for minfree memory size (in page units).
The parameter value set for K^Kernel is "2048,4096,6656,9216,14336,19456".
- /sys/module/lowmemorykiller/parameters/adj
This file includes the comma separated array of oomadj factors, if the corresponding minfree threshold has been reached, one of the process with an oomadj greater than this number will be killed.
The oomadj factor is a property associated to each process, its value is in a range from -17 to +15, the processes with a higher oomadj factor will be the first to be killed when a specific minfree threshold has been reached.
The parameter value set for K^Kernel is "0,20,50,100,250,500".

Frandom - Fast Random Generator
As Eli Billauer (the creator of this module) said, Frandom is a Linux kernel random number generator, which is 10-50 times faster than what you get from Linux built-in /dev/urandom. And it uses very little (/dev/frandom) or none (/dev/erandom) of the kernel's entropy pool, so it is very useful for applications that require a handy source for lots of random data.

How to test if frandom builtin module is correctly working:

- Download the script named frandom_test.sh
- Using your preferred file explorer, copy the file inside the folder /data/local of your device
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Open Terminal Emulator
- Run this command
Code:
/data/local/frandom_test.sh
You should see a result similar to this one:

If the urandom tests take more than 1 or 2 seconds and are more different than related frandom tests, then the random number generation is not fully optimized for your currently used kernel...
How to disable / re-enable the redirection to frandom module during boot process:

By using Terminal Emulator:
- Run these commands to create the flag file and disable Frandom redirection:
Code:
su
touch /data/frandom_disabled
- Or run these commands to delete the flag file and re-enable Frandom redirection:
Code:
su
rm /data/frandom_disabled
The change will take effect after a reboot.

RAM Console
This feature is useful expecially for development and debugging purposes, when occurs kernel panic / unexpected shutdowns or reboots. Pratically, the kernel messages are also stored inside a little RAM portion and restored during reboot after a kernel panic, inside the file /proc/last_kmsg.


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.

How to enable/disable the Dynamic FSync (default enabled):

1) By downloading and using Trickster MOD
2) By directly editing the file /sys/kernel/dyn_fsync/Dyn_fsync_active and setting 1 to enable the dynamic fsync, 0 to disable it (note that set value will be lost after a reboot/shutdown)
3) 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 fsync feature
Code:
su
echo 0 > /sys/kernel/dyn_fsync/Dyn_fsync_active
- Or run this command to re-enable the dynamic fsync feature
Code:
su
echo 1 > /sys/kernel/dyn_fsync/Dyn_fsync_active

Dynamic dirty page writebacks
This feature has been developed by me 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)

In my kernel builds, during boot, I set other customized values:
- an interval of 30 seconds while the screen is on
- an interval of 10 seconds when the screen is off

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
Code:
su
echo 0 > /proc/sys/vm/dynamic_dirty_writeback
- Or run this command to re-enable the dynamic dirty page writebacks feature
Code:
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)
Code:
su
echo "3000" > /proc/sys/vm/dirty_writeback_active_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_suspend_centisecs
The Following 17 Users Say Thank You to Christopher83 For This Useful Post: [ View ] Gift Christopher83 Ad-Free
25th November 2013, 10:39 PM |#3  
Christopher83's Avatar
OP Inactive Recognized Developer
Flag Milan
Thanks Meter: 12,843
 
Donate to Me
More
Special features and sysfs settings (Part 2):

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

I 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 K^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
Code:
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
Code:
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
Code:
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

LowMemoryKiller management of not killable processes
This feature allows to define processes and system processes white-lists filled with the preferred process names and to not be killed by lowmemorykiller, unless it is absolutely necessary.

This feature exposes four new lowmemorykiller parameters:
- donotkill_proc, is the flag to enable / disable this feature for the processes chosen by the user
- donotkill_sysproc, is the flag to enable / disable this feature for the system processes chosen by the user
- donotkill_proc_names, is the list of process names (comma separated) chosen by the user to be preserved from killing
- donotkill_sysproc_names, is the list of user system process names (comma separated) chosen by the user to be preserved from killing

When the lowmemorykiller needs to free ram, it will first kill the processes not included inside the two process name lists chosen by the user.
If there are no more standard killable processes, then it will be necessary to kill one of the processes included inside one of the two white-lists, to prevent system hangs, slowdowns, etc.

How to customize the white lists of processes to preserve from killing:

On K^Kernel the feature is enabled by default and the provided processes white lists are the following:
- donotkill_proc_names = "com.cyanogenmod.trebuchet,com.anddoes.launcher,co m.teslacoilsw.launcher,org.adwfreak.launcher,gtp.n extlauncher,android.inputmethod.latin,com.touchtyp e.swiftkey"
this means that Trebuchet Launcher, Apex Launcher, Nova Launcher, ADW Launcher, Next Launcher, stock keyboard and SwiftKey keyboard will be preserved from killing
- donotkill_sysproc_names = "android.process.acore,com.android.phone,com.bel.a ndroid.dspmanager"
this means that the system process, the phone process and DSP Manager will be preserved from killing

1) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 80dnkp
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred status and processes list
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
2) By directly editing the files inside /sys/module/lowmemorykiller/parameters (note that set values will be lost after a reboot/shutdown)
3) By using Terminal Emulator (note that set values will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands if you want to enable the feature
Code:
# To enable this feature for the processes chosen by the user
echo 1 > /sys/module/lowmemorykiller/parameters/donotkill_proc
# To enable this feature for the system processes chosen by the user
echo 1 > /sys/module/lowmemorykiller/parameters/donotkill_sysproc
- Run these commands if you want to disable the feature
Code:
# To disable this feature for the processes chosen by the user
echo 0 > /sys/module/lowmemorykiller/parameters/donotkill_proc
# To disable this feature for the system processes chosen by the user
echo 0 > /sys/module/lowmemorykiller/parameters/donotkill_sysproc
- Run this command if you want to add, for example, Trebuchet Launcher (CM default launcher) and the default keyboard to the processes white list
Code:
echo "com.cyanogenmod.trebuchet,android.inputmethod.latin" > /sys/module/lowmemorykiller/parameters/donotkill_proc_names
- Run this command if you want to add, for example, the system process, the phone process and DSP Manager to the system processes white list
Code:
echo "android.process.acore,com.android.phone,com.bel.android.dspmanager" > /sys/module/lowmemorykiller/parameters/donotkill_sysproc_names

Work in progress...
The Following 16 Users Say Thank You to Christopher83 For This Useful Post: [ View ] Gift Christopher83 Ad-Free
25th November 2013, 10:39 PM |#4  
Christopher83's Avatar
OP Inactive Recognized Developer
Flag Milan
Thanks Meter: 12,843
 
Donate to Me
More
FAQ - Frequently asked questions:

Q: What are the differences between EXUV and UV kernel versions?
A: The EXUV kernel versions have extremely undervolted settings for the cpu frequencies, they allows to have a very low battery drain, instead the UV kernel versions have undervolted settings a bit higher than EXUV versions, but always lower than stock kernel settings.
The EXUV kernel versions could give some problems (freezes, shutdowns, huge lags) on some devices because the cpu doesn't support too low voltage settings.
For a lower battery consumption, I suggest you to try EXUV versions first and to switch to UV versions only if you encounter one of the above mentioned problems.

Q: What are the differences between 360MB, 370MB and 390MB versions?
A: 360MB, 370MB and 390MB kernel versions have different free ram available for user space, with a higher free ram your device will work better with heavy apps, many concurrently used apps, heavy games, etc.
- 360MB versions have additional 8 MB of free ram than stock kernels (352 MB of free ram), they are suitable for the users that use the device primarly for calls, messages, simple apps and simple games. The camera, video recording (both 480p and 720p modes) and video playback are fully working.
- 370MB versions have additional 18 MB of free ram than stock kernels, they are suitable for the users that use the device also with heavy apps, various concurrently used apps and games. The camera, video recording (both 480p and 720p modes) and video playback are fully working.
- 390MB versions have additional 38 MB of free ram than stock kernels, they are suitable for the users that use the device also with heavy apps, many concurrently used apps and heavy games. The camera and video playback are fully working, the video recording works only in 480p mode.

Q: How can I get the Performance and Developer Options entries inside Settings menu?
A: Go inside Settings -> About Phone -> Scroll down and tap 7 times on Build number (it's an Easter Egg).

Q: How can I get the log after an unexpected shutdown / reboot?
A: After an unexpected shutdown / reboot of the device, if the problem may be kernel related, you should have the /proc/last_kmsg, if so, send me that log and I'll check it to find the possible cause of the problem.

Q: How can I get the logs when I encounter strange system issues while it's running?
A: Check first if the problems could be related to an app you're using and if you changed something in the last days before facing those issues.
If the problem started after installing the kernel, then let me have you logcat and dmesg:
- Open Terminal Emulator and execute these commands:
Code:
su
dmesg > /sdcard/dmesg.txt
locat -v time -d > /sdcard/logcat.txt
- Open you preferred file manager and go inside the internal sd card partition /sdcard
- Send me the dmesg.txt and logcat.txt files, if you want zip them first

Q: How can I mount a shared Windows folder with CIFS module?
1) By using Terminal Emulator
Code:
mount -o unc=\\\\ip\\share,noserverino,username=user,password=password -t cifs //ip/share /mnt/cifs
2) Downloading and using CifsManager and configuring the new share as follow:
- Share Path = ip/share
- Mount Point = /mnt/cifs/share
- Username = username
- Password = password
- Options = unc=\\\\ip\\share,noserverino

Where:
ip is the ip address of your pc where the folder is shared
share is the shared folder name
user is the user name that can access the shared folder
password is the user password
/mnt/cifs is the mount point (must be created if you'd like to use the command approach with Terminal Emulator)
The Following 14 Users Say Thank You to Christopher83 For This Useful Post: [ View ] Gift Christopher83 Ad-Free
25th November 2013, 10:40 PM |#5  
Christopher83's Avatar
OP Inactive Recognized Developer
Flag Milan
Thanks Meter: 12,843
 
Donate to Me
More
Reserved, just in case...
The Following 10 Users Say Thank You to Christopher83 For This Useful Post: [ View ] Gift Christopher83 Ad-Free
26th November 2013, 07:51 AM |#6  
TheTechnolgyhelper's Avatar
Senior Member
Flag Remscheid
Thanks Meter: 353
 
More
Thank you Chris for you hard work

Gesendet von meinem GT-I9001 mit Tapatalk
The Following User Says Thank You to TheTechnolgyhelper For This Useful Post: [ View ] Gift TheTechnolgyhelper Ad-Free
26th November 2013, 08:25 AM |#7  
Senior Member
Thanks Meter: 29
 
More
thaaanks!!!
The Following User Says Thank You to oscarmalo For This Useful Post: [ View ] Gift oscarmalo Ad-Free
26th November 2013, 08:40 AM |#8  
sgspluss's Avatar
Senior Member
Thanks Meter: 5,240
 
Donate to Me
More
Have flashed KK one hour ago with your K^Kernel 390MB OC-UV and its taste very good

Thank you Christopher for your kernel, its fast as allways and running without any problems
The Following User Says Thank You to sgspluss For This Useful Post: [ View ] Gift sgspluss Ad-Free
26th November 2013, 10:30 AM |#9  
Senior Member
Thanks Meter: 33
 
More
Chris there is a problem with KK.we can't switch internal and external storages even if we change the line in built.prop.I red in another thread that in KK that feature is now implemented inside the kernel ramdisk.do you think you can see to it and if so make kernel versions with that feature?for me it's everything to have my 32g SD as internal.thank you again for everything you have done christo.
26th November 2013, 11:33 AM |#10  
XeLLaR*'s Avatar
Senior Member
Flag DevConnection
Thanks Meter: 4,741
 
More
Great Kernel!

Setup:
Fresh Alpha1
K^K v1.0 370MB BigMem
DevCon GApps
Low_Ram disabled
200+ Apps installed

My Phone does not like the oc table, but fixed thanks to your init.d script!

Runs very well and batterylife is also very good!

Gesendet von meinem Nexus 4 mit Tapatalk 2
The Following User Says Thank You to XeLLaR* For This Useful Post: [ View ] Gift XeLLaR* Ad-Free
26th November 2013, 02:24 PM |#11  
Calin's Avatar
Retired Forum Moderator / Recognized Developer
Flag Oradea
Thanks Meter: 5,380
 
Donate to Me
More
Awesome!!

Thank You Christopher and all the others developers to maintain the Galaxy S Plus Alive !!
The Following User Says Thank You to Calin For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
3.4, cm11, kernel, kitkat 4.4, linaro

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes