Tweak Android for Performance, and increase battery by Saving Power Usage with Sysctl - G1 Android Development

Here I will post tweaks as I find them to optimize Android.
When echoing in the following sysctl settings they do not remain after reboot, so we can adb remount then create a sysctl.conf file on our pc's with these settings, then ./adb push sysctl.conf /etc/ then the kernel should apply the settings every reboot
For examples of a sysctl.conf use google: Sysctl.conf Examples
Open a Terminal and Execute these commands as root
Tweak virtual memory to conserve power when running on battery:
Code:
echo 0 > /proc/sys/vm/swappiness #can be ignored if you dont use swap
echo 0 > /proc/sys/vm/dirty_expire_centisecs #can be ignored if you dont use swap
echo 0 > /proc/sys/vm/dirty_writeback_centisecs #can be ignored if you dont use swap
echo 60 > /proc/sys/vm/dirty_background_ratio
echo 95 > /proc/sys/vm/dirty_ratio
Tweak virtual memory for running on Charger
Code:
echo 0 > /proc/sys/vm/swappiness #can be ignored if you dont use swap
echo 3000 > /proc/sys/vm/dirty_expire_centisecs #can be ignored if you dont use swap
echo 500 > /proc/sys/vm/dirty_writeback_centisecs #can be ignored if you dont use swap
echo 10 > /proc/sys/vm/dirty_background_ratio
echo 40 > /proc/sys/vm/dirty_ratio
Detecting apps/services that hog the battery/cpu:
Also while on battery, you should stop all applications that don't really stay idle when you're not using them, if you want to find which apps arent really staying idle you can:
Code:
strace -p $(pidof yourapp) # for all your running applications
ps aux | awk '{print$10,$11}' | sort -n # will list all running softs sorted by used cpu time
By default when Linux runs out of memory it goes through the process list and starts killing off processes that it thinks are using too much memory. This sysctl makes Linux kill the runaway process that made the system run out of memory instead, which is usually what you want.(this will also reduce cpu time and increase battery usage).
Code:
sysctl -w vm.oom_kill_allocating_task=1
Credit: ccpp0
vfs_cache_pressure to 10 , gives more mem to cache fs dentry and inode to save cpu
At the default value of vfs_cache_pressure = 100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.
Code:
sysctl -w vm.vfs_cache_pressure=10
I'll be adding more tweaks for sysctl and basic cmd line tweaks as I find them, also these tweaks would be good integrated into roms, apps, and a power-save widget if anyone wants to get creative.

a few questions
do i enter this into the terminal emulator? also does this only need to be entered in one time? thank you in advance for any help.

great find.. will keep my eye on this thread

david1171 said:
do i enter this into the terminal emulator? also does this only need to be entered in one time? thank you in advance for any help.
Click to expand...
Click to collapse
yes you can enter it in via terminal emulator or ./adb shell, the echo'd settings are not permanent and will reset after reboot, so use the settings to test, then follow the directions to create a /etc/sysctl.conf file to make the settings permanent after you feel comfortable with the settings(if you notice improvement)
defcon

Wow, this is cool, thank you!
Could you maybe add some more comments, I don't really understand what the single commands do. Or some place, where the function of e.g. "dirty_expire_centisecs" is explained?
One more precise question though: If I don't have a swap file on sd, does the tweaking of the swappiness still change anything?
Greetings!

free-sidux said:
Wow, this is cool, thank you!
Could you maybe add some more comments, I don't really understand what the single commands do. Or some place, where the function of e.g. "dirty_expire_centisecs" is explained?
One more precise question though: If I don't have a swap file on sd, does the tweaking of the swappiness still change anything?
Greetings!
Click to expand...
Click to collapse
there is no swap space on G1, so settings related to the swap can be ignored.
echo 0 > /proc/sys/vm/dirty_expire_centisecs
echo 0 > /proc/sys/vm/dirty_writeback_centisecs
never writes out dirty pages ?

free-sidux said:
Wow, this is cool, thank you!
Could you maybe add some more comments, I don't really understand what the single commands do. Or some place, where the function of e.g. "dirty_expire_centisecs" is explained?
One more precise question though: If I don't have a swap file on sd, does the tweaking of the swappiness still change anything?
Greetings!
Click to expand...
Click to collapse
http://tinyurl.com/nlb9ws
Note: The value of vm.swappiness=0 states that no swap space will be used at all, basically it can be ignored if you dont use swap though

defconoi said:
http://tinyurl.com/nlb9ws
Note: The value of vm.swappiness=0 states that no swap space will be used at all, basically it can be ignored if you dont use swap though
Click to expand...
Click to collapse
set vfs_cache_pressure to 10 , gives more mem to cache fs dentry and inode to save cpu "wa".

how do i create a Sysctl.conf file with this script?
i tried the link of examples but all i could find was info about it.
everything else works but when i try
sysctl vm.block_dump=1
i get sysctl: error: 'vm.block_dump=1' is an unknown key
any ideas?

actually ya know what I think we can just disable sysctl all together in menuconfig->Filesystems->Pseudo Filesystems->Proc->Sysctl Support when compiling a new kernel and setting these tweaks right in the kernel.
Says in menuconfig"As it is generally a good thing, you should say Y here unless
building a kernel for install/rescue disks or your system is very
limited in memory."
So I think we can gain some memory disabling this since we dont really need it

disable /dev/mem
Also I think we can disable the Memory Device Driver, /dev/mem, it says it can be disabled for security conscious and can be disabled on memory tight systems, which we are definitely memory tight plus there's just no valid app that uses /dev/mem on actual memory.
Other popular users of /dev/mem are rootkits and the like.
(note: mmap access of memory via /dev/mem was already not allowed since
a really long time)
People who want to use /dev/mem for kernel debugging can enable the config
option.

tshizzle said:
how do i create a Sysctl.conf file with this script?
i tried the link of examples but all i could find was info about it.
everything else works but when i try
sysctl vm.block_dump=1
i get sysctl: error: 'vm.block_dump=1' is an unknown key
any ideas?
Click to expand...
Click to collapse
I have the same exact questions that u do

Unix98_ptys
Also do we really need UNIX98_PTYS enabled?
We can also use this to conserve memory if we dont need this as well...
menuconfig says:
"Unix98 PTY support UNIX98_PTYS
A pseudo terminal (PTY) is a software device consisting of two
halves: a master and a slave. The slave device behaves identical to
a physical terminal; the master device is used by a process to
read data from and write data to the slave, thereby emulating a
terminal. Typical programs for the master side are telnet servers
and xterms.
Linux has traditionally used the BSD-like names /dev/ptyxx for
masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
has a number of problems. The GNU C library glibc 2.1 and later,
however, supports the Unix98 naming standard: in order to acquire a
pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
terminal is then made available to the process and the pseudo
terminal slave can be accessed as /dev/pts/<number>. What was
traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
All modern Linux systems use the Unix98 ptys. Say Y unless
you're on an embedded system and want to conserve memory."

jroid said:
I have the same exact questions that u do
Click to expand...
Click to collapse
ahhhh it looks vm.block_dump=1 isnt a valid sysctl option, disregard that, gonna remove it from the first post

defconoi said:
ahhhh it looks vm.block_dump=1 isnt a valid sysctl option, disregard that, gonna remove it from the first post
Click to expand...
Click to collapse
yea. all the other ones work though. how would we make the file??

jroid said:
yea. all the other ones work though. how would we make the file??
Click to expand...
Click to collapse
adb remount
create sysctl.conf on your system
then adb push sysctk.conf /etc and the settings will be set every reboot.

defconoi said:
adb remount
create sysctl.conf on your system
then adb push sysctk.conf /etc and the settings will be set every reboot.
Click to expand...
Click to collapse
ok so it would be something like this?
adb remount
adb shell
mkdir /system/sysctl.conf
adb push sysctl.conf /system/etc

jroid said:
ok so it would be something like this?
adb remount
adb shell
mkdir /system/sysctl.conf
adb push sysctl.conf /system/etc
Click to expand...
Click to collapse
no, adb push sysctl.conf /etc

this isn't working. i created the dir sysctl.conf in /system then tried adb pushing it but says no such file or dir. then i tried in adb shell cp /system/sysctl.conf /etc
it says cp: omitting sysctl.conf is a directory"
couldnt i just create it directly in /etc?
like this mkdir /system/etc/sysctl.conf

defconoi said:
no, adb push sysctl.conf /etc
Click to expand...
Click to collapse
on android /etc is within the /system/etc directory.

Related

[DEV] Script for tweaks (version 1.02) 18-12-2010

Here is a script i've made (had nothing to do, so...).
Phone must be rooted and have busybox installed.
What first menu looks like:
1 - enable/disable hardware acceleration
2 - enable/disable jit
3 - enable/disable stagefright player
4 - change heapsize
s - show status
r - revert to original configuration
q - quit (don't forget to reboot your phone!)
==================
enter your option:
Click to expand...
Click to collapse
Download:
http://www.4shared.com/file/gApTB6EG/tweaks.html
md5 b0865d9de67a82215913512cb644211d
Just copy the file to your sdcard. Then in a terminal emulator run:
su
cat /sdcard/tweaks > /data/tweaks
rm /sdcard/tweaks
cd /data/
./tweaks
If it doesn't run, type first:
chmod 755 /data/tweaks
Additional notes:
Script does not work if run from sdcard, must be in /data/ or /system/ (this one goes to allsalvati for testing)
---
If anything is wrong i will fix it, but only if you give me feedback
If you know any good tweaks, say it and i'll add them.
---
Changelog:
version 1.02:
backup/restore added
version 1.01d:
working again. sorry for the mess...
version 1.01c:
nothing new. just rearranging code
version 1.01b:
messages were not staying in output. fixed
version 1.01a:
small fix. v1.01 was not working
version 1.01:
added status menu
ruigui said:
Here is a script i've made (had nothing to do, so...). Phone must have busybox.
Download:
http://www.4shared.com/file/gApTB6EG/tweaks.html
md5 ea568c399c67ecd87db0dd790cdf0e93
Just copy the file to your sdcard. Then in a terminal emulator run:
cd /sdcard/
./tweaks
If it doesn't run, type first:
chmod 777 /sdcard/tweaks
Please give me some feedback. I don't own the phone so i can't test.
Click to expand...
Click to collapse
what the script does?
So script should be able to do:
enable/disable hw acceleration
enable/disable jit
enable/disable stagefright player
change heapsize
Yes. For now it's what it does.
The ideia is to be able to enable/disable a certain tweak, without reflashing zips, and rewriting files in phone.
But i need some feedback to know if it is working. I can't test it.
It will only change values in /data/local.prop, nothing else.
It seems that it is well written, so I will try that and let you know what's happened.
Thanks for testing. I'm still waiting to have some money so i can buy this phone...
Meanwhile, i'm "playing" with ROMs and files. I'm not good at scripting, but i'm trying to learn while doing something useful.
How much did you increase the heap size?
domenic_s said:
How much did you increase the heap size?
Click to expand...
Click to collapse
I didn't increase it. Script shows this message:
"default=24, recommended=32"
"enter new heapsize value (1-64): "
You can enter any value between 1 and 64.
If you enter any other value, or a string, character, symbol... script will show this message:
"wrong value"
"please input a value between 1 and 64"
For those who don't feel like editing this themselves this is great. Thanks for releasing it for people to try out more tweaks on stock ROMs.
i'm trying to run this script and gives me the following message: ./tweaks: permission denied
Before anything i typed su, then chmod 777 and it gave me error.
It should work be working...
Anyone else confirms this issue? Is this script running or not?
If it is working and there are more tweaks, i can easilly add them to the script.
If this is an isolated case, i really can't help. I don't own an android phone (yet), so i can't test....
allsalvati do you have busybox installed?
No, i don't.
Sent from my LG-P500h using XDA App
That may be your issue.
You must mount /system/ as read-write, then copy busybox binary to /system/xbin/, then run these commands in terminal emulator:
su
cd /system/xbin
/system/bin/chmod 755 busybox
./busybox --install -s /system/xbin
After that you can mount /system/ as read only again, and reboot your phone.
I don't know if there is another way to install it that is easier.
I downladed busybox installer from market and the app says that was installed. The. /tweaks gives me the same message.
How do i test if busybox was installed right?
Sent from my LG-P500h using XDA App
I found this:
That is a problem, you cannot chmod a script to executable on the SD card. (well some things can, but 99% no) the system is designed to prevent u executing scripts from an SD card
cp it to /system/xbin or /system/bin.
Or if u hate to see it in system', use /data/
THEN chmod it. should be fine to run
Click to expand...
Click to collapse
Try to copy the file to /data/ (so you don't mess with /system/), and then try to run it with:
cd /data/
chmod 777 tweaks
./tweaks
It should not need to be run as root
Moved to /data and worked.
I changed heap size to 32 and disabled hardware accelaration just to test.
With hw acc - 981 on Quadrant
Without - 820
So i think this is working.
Perhaps you should print the values so the user can see what is enabled or not before apply.
Thanks for your help
Sent from my LG-P500h using XDA App
Can you test something for me?
Make sure you have hardware acceleration disabled, and reboot you phone.
Then open terminal and run:
getprop | grep hw (see what it outputs)
then run the script, enable hardware acceleration on it, but DON'T reboot your phone yet.
Then exit script, and run again:
getprop | grep hw
Has the value changed, or is it the same?
I need to know if the system assumes immediately any changes (although they may not be functional until reboot).
This is needed to work on your request.
allsalvati said:
Perhaps you should print the values so the user can see what is enabled or not before apply.
Click to expand...
Click to collapse
I'll work on that and post an update after someone tries what i asked above.
Thanks for testing
EDIT: to test benchmarks, enable/disable jit. It gives greater differences in values
I tried what you say and both outputs are the same:
$getprop | grep hw
[debug.sf.hw]: [0]
[hw.keyboards.65537.devname]: [7k_handset]
[hw.keyboards.65540.devname]: [thunder_keypad]
[hw.keyboards.65541.devname]: [touch_mcs6000]
[hw.keyboards.65542.devname]: [atcmd_virtual_kbd]
Edit: Tested disabling JIT and it worked. Linpack Before 7.35 - After 4.3
So i can't rely on getprop to check current values...
If anything is changed, getprop won't give the right output till reboot.
Damn... Script was almost updated. Now i must find a new way and redo this section.
Thanks for testing again
EDIT:
New version for download at first post. status menu added.
I think it's all ok.
It seems work fine on my phone. But I can't see the status. When I choose to see current status or status after reboot, the screen of my emulator returns too fast to the selection menu (show curent status or after reboot) and I can't see anything !

[MOD] One stop for tweaks and other useful cool stuff

ok, from my android tweaking and playing around with all kinds of settings and other things i know it can be somewhat hard to find everything you might need to make the most of your android device so i will put links to them here along with providing support and my own little discoveries here...if anyone knows anything else that is cool or useful just post it and i'll update this post (btw these are tested on droid 1 only but many may apply to most android devices)
*Anyone who knows of any other tweaks/mods/scripts/useful terminal commands please feel free to post and i'll add it here (after testing it if possible)*
***disclaimer- I am not responsible for any damage you may do to your device, please make sure to have a backup before doing any of these tweaks***
first off how about a simple rooting/returning to stock guide?
quick root guide
1)download these files
http://www.motorola.com/staticfiles/Support/Experiences/Global_Drivers/MotoHelper_2.0.40_Driver_4.9.0.exe
http://wonderly.com/bb/DROID/OEM/rsdlite_5.0.msi
http://wonderly.com/bb/DROID/OEM/VZW_A855_QSC6085BP_RZRECOVERY_UPDATE.sbf
http://wonderly.com/bb/DROID/OEM/update.zip
2)install the first 2 links in order
3)connect your phone via usb to your computer and copy the update.zip you downloaded to your sdcard
4)reboot your phone and hold power + vloume up + the camera button until you see the screen that says bootloader battery ok
5)open rsd lite and see if it recognizes your phone (basically any entry in the model column) and slide your phone keyboard open
6) click the ... near the start button and navigate and select the VZW_A855_QSC6085BP_RZRECOVERY_UPDATE.sbf file
7)click start and WATCH FOR "Phone[0000]: Phone is being rebooted" On your phone the screen will change to "SW Update Complete" and your phone will reboot within a second or two. You want to be already holding the x button on your keyboard to boot into recovery mode when the phone actually reboots so the stock OS doesnt erase the new recovery you just flashed
8) using the volume keys to move through the menu, the camera button to select and the power button to go back, go to install and select the update.zip you put on your sdcard earlier and select install update.zip
9) then select "reboot into android" and enjoy the benefits of being rooted
return to stock
1)download these files
http://www.motorola.com/staticfiles...al_Drivers/MotoHelper_2.0.40_Driver_4.9.0.exe
http://wonderly.com/bb/DROID/OEM/rsdlite_5.0.msi
http://wonderly.com/bb/DROID/OEM/VZW_A855_FRG22D_QSC6085BP_C_01.43.01P_SW_UPDATE.sbf
2)install the first 2 files
3)reboot your phone and hold power + vloume up + the camera button until you see the screen that says bootloader battery ok
4)connect your phone via usb to your computer and reboot your phone and hold power + vloume up + the camera button until you see the screen that says bootloader battery ok
5)open rsd lite and see if it recognizes your phone (basically any entry in the model column)
here are are some useful build.prop tweaks I've encountered along the way, just put the line into the build.prop or modify it if its already in there, save, wipe dalvik cache and reboot
6) click the ... near the start button and navigate and select the VZW_A855_FRG22D_QSC6085BP_C_01.43.01P_SW_UPDATE.sb f you downloaded earlier
7)click start and let it run and reboot automatically (it should work even if rsd lite says the result was fail)
8) you are now on stock unrooted froyo
FRG22D
(optional) 9) go to settings > about phone> check for updates and allow system updates to download and install (allows for a super clean setup if you are planning to re-root)
for possibly better scrolling speed, can be set to any number from 35-300:
# This defines the max event window manager can
# handle in 1 s. We may adjust this # for performance
# reason later
windowsmgr.max_events_per_sec=
change lcd density (already in build.prop), which is like changing the resolution on a windows computer can be anywhere from 140 to 260 (under 200 not recommended because everything may be too small for the phone to be usable:
ro.sf.lcd_density=
dalvik cache virtual memory size (already in build.prop)...can also help performance. set anywhere from 24m to 64m based on how complex your setup is. i.e. tons of apps, in depth theme, memory intensive apps, etc.
dalvik.vm.heapsize=
incoming ringer delay (already in build.prop) sets how soon the phone starts ringing when a call comes in. set between 0 and 2000
ro.telephony.call_ring.delay=
proximity delay. sets how long before screen turns off during call. set between 0 and 600
# Proximit sensor screen off delay
mot.proximity.delay=
tcp stack- optimizes data performance
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
enable hardware acceleration
# Render UI through GPU instead of CPU
# Comment out if this causes laggy UI (it should speed up UI)
debug.sf.hw=1
sleep mode for battery savings. 0 means power collapse suspend, 1 is power collapse (usually the best choice), 2 is apps go to sleep, 3 is show clock and wait, 4 is wait for interrupt...not sure which each one does or is good for, just know about this little tweak lol
# Battery Savings (Sleep Mode)
pm.sleep_mode=
more battery savings
# When moving through zones or losing signal, having a delay
# smooths out constant disconnects and reconnects, which in turn
# saves a ton of battery life!
ro.mot.eri.losalert.delay=1000
disable sending usage data
ro.config.nocheckin=1
wifi scan interval (already in build.prop) can save battery as well. set from 15 to 999
# Time between scans in seconds. Keep it high to minimize battery drain.
# This only affects the case in which there are remembered access points,
# but none are in range.
wifi.supplicant_scan_interval=
ok, now for some useful links (all credit goes to the creators of these cool tweaks/apps/programs
v6 supercharger by zepplinrox - http://forum.xda-developers.com/showpost.php?p=18703418&postcount=5021
Deodex/odex tweak by Nibras, Reeza & Danzano (thanks to BrUhNiGGs for finding this) - http://www.droidforums.net/forum/steel-droid/200388-ram-tweak-free-up-more-ram-make-apps-load-faster.html
setcpu for free (legitimately legal lol) - http://forum.xda-developers.com/showthread.php?t=505419
wifi tethering app Downloads - http://code.google.com/p/android-wifi-tether/downloads/list
wired tethering app Downloads - http://code.google.com/p/android-wired-tether/downloads/list
easy install of adb http://www.droidforums.net/forum/chevyno1/162984-your-1-adb-source-7-29-11-a.html
Guide to building a rom from source (credit to chevycam and SnkBitten) - http://www.droidforums.net/forum/steel-droid/196475-guide-how-build-your-own-rom-cm7-source.html
Ok, here's a new section with just general tips, tricks and scripts
Useful terminal emulator scripts run as superuser (su)
*Using the debugging logging to report issues
Code:
logcat > /mnt/sdcard/logcat.txt
wait 4-5 seconds then hold volume up and press f on the keyboard to stop it
if logcat is disabled then do this instead
Code:
dmesg > /mnt/sdcard/dmesg.txt
wait 4-5 seconds then hold volume up and press f on the keyboard to stop it
*Find top CPU/memory using apps. value after -m is how many apps to show, value after -n is how many times to update (be sure to set this value or it will run endlessly until terminal is closed)
Code:
top -m 10 -n 1
*Find md5sum for downloaded files (checks to ensure proper downloads especially for roms, just compare your result to whatever value the rom developer provides and they should match)
Code:
md5sum /mnt/sdcard/(file path on sdcard)
For example
Code:
md5sum /mnt/sdcard/download/SD_9.0.0.zip
*Use swap partition without swapper2.
Add this script to the end of any file in the /etc/init.d folder. If you don't have one just run it in terminal emulator each reboot and run it in terminal first since sometimes its mmcblk0p2 instead of mmcblk0p3 depending on where you have the swap partition (or use the app script manager to make it run at boot. Script manager doesn't run continuously like swapper2)
Code:
swapon /dev/block/mmcblk0p3
And to turn swap off
Code:
swapoff /dev/block/mmcblk0p3
*Setting swappiness
Add or edit this line in the file etc/sysctl.config using whatever value you want, just keep the spaces (open in text editor)
vm.swappiness = 30
Or add this to the end of a script in init.d or run in terminal emulator
Code:
sysctl -w vm.swappiness=30
*Loading a module for apps2sdext (link2sd style apps2sd)
Run this in terminal emulator with superuser permission, substituting ext3 for whatever extension you want loaded (keep the .ko though)
Code:
insmod /system/lib/modules/ext3.ko
or the simple way
Code:
modprobe ext3
*Listing loaded modules
Run this in terminal emulator with superuser permissions
Code:
lsmod
*Forcing a hot reboot to clear caches
Run this in terminal emulator with superuser permissions
Code:
pkill zygote
*terminal tips-
Find list of many possible scripts to run
Code:
busybox
List sysctl commands
Code:
sysct -h
List first or last 10 lines of another scripts output (note | is not lower case L, its a separate character)
First 10-
Code:
(script) | head
Last 10
Code:
(script) | tail
Example (list first 10 sysctl values)
Code:
sysctl -a | head
Finding lines with certain letters/word in another scripts output
Code:
(script) | grep (letters/word)
Example (show only sysctl lines with vm in them) (note | is not lower case L, its a separate character)
Code:
sysctl -a | grep vm
Don't worry more to come soon
Ok, those are the well tested tweaks, now for a few experimental ones. Please make sure to have a backup ready to restore since these ARE experimental and may cause your rom not to load
improve peformance?
Add this to the build.prop
#disable the zygote loader
ro.wmt.blcr.enable=0
Fix app issues? (change it to 0 to improve performance)
Add this to build.prop
ro.kernel.android.checkjni=1
Change the I/O scheduler (effects how your phone reads and writes data)(first line tells you whats available and what you currently have in [ ], then put whichever one you want in the "" after echo, and the last line will confirm the change)
Code:
cat /sys/block/*/queue/scheduler
for i in /sys/block/*/queue/scheduler
do
echo "deadline" > $i
done
cat /sys/block/*/queue/scheduler
Increse overall touch resposivness?
Add these to build.prop
debug.performance.tuning=1
video.accelerate.hw=1
ro.min_pointer_dur=8
Raise Photo and video quality?
Add these to build.prop
ro.media.enc.jpeg.quality=100
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
change sdcard buffer speed
run in terminal emulator as superuser (su) or put #!/system/bin/sh as first line and put in /system/etc/init.d (you can change the value in the "echo 512 > /sys/devices/virtual/bdi/179:0/read_ahead_kb" line to suit your needs- common values are 256, 512, 1024, 2048, 3072, 4096, 5120, 6144)
Code:
for i in /sys/devices/virtual/bdi/*
do
echo 2 > $i/read_ahead_kb
done
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo 2 > /sys/devices/virtual/bdi/default/read_ahead_kb
or you can try just simply using the simple version
Code:
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
Disable boot animation
add to build.prop (use caution after wiping dalvik, it will appear to hang at the M but its usually still booting up all the way)
dev.sfbootcomplete=0
Use dalvik JIT compiler
add to build.prop (Just In Time compiler is much faster)
dalvik.vm.execution-mode=int:jit
Improve performance?
change in build.prop
ro.setupwizard.mode=DISABLED
Rom dependent tweaks (will only work if these features are included in your rom and most are included in settings anyway, most of the time they are but if not sure then ask the dev) add these to build.prop, 1 is on 0 is off
help to free up unused ram-
persist.sys.purgeable_assets=
stop usb debugging on notification-
persist.adb.notify=
Force capacitive buttons to stay on while screen is on?-
ro.mot.buttonlight.timeout=
Improve screen quality at the cost of performance-
persist.sys.use.dithering=
*reserved*
**reserved**
and one more just in case
***reserved***
btw, i hope i posted this right, I'm still new here to xda forums, i hope i posted in the right section too...if not then someone can go ahead move it (if possible)
Nice collection!
Say, do you have anything specific to CDMA bandwidth?
I know my 3G TurboCharger has a positive effect somehow even though most of the entries are GSM related but hey... every bit helps
zeppelinrox said:
Nice collection!
Say, do you have anything specific to CDMA bandwidth?
I know my 3G TurboCharger has a positive effect somehow even though most of the entries are GSM related but hey... every bit helps
Click to expand...
Click to collapse
not sure if any of these would apply to data at all but i know kfazz posted them as the only ril settings for the droid, maybe this could further improve speed on all devices if anything applies to mobile data
Moto ril sholes accepted properties found via strings
persist.ril.mux.timeout.enbld
persist.ril.enableradio.powerup
persist.ril.uart.flowctrl
persist.ril.mux.noofchannels
persist.ril.mux.ttydevice
persist.ril.mux.retries
persist.ril.mux.sleep
persist.ril.mux.logmask
persist.ril.rssi.enable.param6
persist.ril.modem.ttydevice
persist.ril.pppd.start.fail.max
ro.ril.ecclist
ro.ril.barcode
ro.build.id
/data/data/com.motorola.motoapr.service/paniclogging
/data/misc/ril/ril_apr.log
Click to expand...
Click to collapse
Ok I guess those are boolean values soget either = 0 or =1 values then?
Well that's weird.. I didn't know there are ro.cdma values...
http://pastebin.com/LWWcSMTD
zeppelinrox said:
Ok I guess those are boolean values soget either = 0 or =1 values then?
Well that's weird.. I didn't know there are ro.cdma values...
http://pastebin.com/LWWcSMTD
Click to expand...
Click to collapse
i searched for ro.cdma and found some others too
ril.cdma.ppp.up=3
ro.radio.use-ppp=yes
net.cdma.ppp-exit=0
cool... maybe you can test them see if you notice a difference?
zeppelinrox said:
cool... maybe you can test them see if you notice a difference?
Click to expand...
Click to collapse
I'll try it out but it I'll try it on something where the radio fully works lol, is still being fixed on the ics build but obviously I have to go back to gingerbread to make and receive calls, if it does anything on GB, then I'll test on ics, who knows it might fix the radio issues somehow
A friend of mine just asked me to root his old droid for him to use merely as a multimedia (music & video) and google docs device. Strictly Wifi, no service plan.
i plan on rooting, wiping, and running SteelDroid on it for him:
http://forum.xda-developers.com/showthread.php?t=1098483
I came across these tweaks and they look AWESOME. I just have a few questions about some of them in particular.
metalspring said:
for possibly better scrolling speed, can be set to any number from 35-300:
# This defines the max event window manager can
# handle in 1 s. We may adjust this # for performance
# reason later
windowsmgr.max_events_per_sec=
Click to expand...
Click to collapse
Is this in the build.prop or elsewhere?
metalspring said:
tcp stack- optimizes data performance
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
Click to expand...
Click to collapse
where do i find and change these? build.prop or elsewhere?
metalspring said:
enable hardware acceleration
# Render UI through GPU instead of CPU
# Comment out if this causes laggy UI (it should speed up UI)
debug.sf.hw=1
disable sending usage data
ro.config.nocheckin=1
Click to expand...
Click to collapse
in build.prop?
metalspring said:
Useful terminal emulator scripts run as superuser (su)
*Use swap partition without swapper2.
Add this script to the end of any file in the /etc/init.d folder. If you don't have one just run it in terminal emulator each reboot (or use the app script manager to make it run at boot. Script manager doesn't run continuously like swapper2)
swapon /dev/block/mmcblk0p3
And to turn swap off
swapoff /dev/block/mmcblk0p3
*Setting swappiness
Add or edit this line in the file etc/sysctl.config using whatever value you want, just keep the spaces (open in text editor)
vm.swappiness = 30
Or add this to the end of a script in init.d or run in terminal emulator
sysctl -w vm.swappiness=30
*Loading a module for apps2sdext (link2sd style apps2sd)
Run this in terminal emulator with superuser permission, substituting ext3 for whatever extension you want loaded (keep the .ko though)
insmod /system/lib/modules/ext3.ko
Click to expand...
Click to collapse
Can i make 2 scripts in script manager that can do this? or are there any available? I know on such a low ram & low internal storage device, swap and apps2sdext would be INCREDIBLY useful.. any tips on making this permanent? If i can make a script in SM i know i can set it start at boot. But i wouldn't need to do that for a2sdext right? once that's set, it's set and needs no changes right?
Also, would you suggest a custom rom like steeldroid or would i be better off stripping out the crapware from the stock ota rom (froyo) and just flashing a better compatible kernel and using some tweaks & scripts to speed things up a bit and optimize them for his purposes.
Let me know what you think?
thanks!
Originally Posted by metalspring
for possibly better scrolling speed, can be set to any number from 35-300:
# This defines the max event window manager can
# handle in 1 s. We may adjust this # for performance
# reason later
windowsmgr.max_events_per_sec=
Click to expand...
Click to collapse
Is this in the build.prop or elsewhere?
Originally Posted by metalspring
tcp stack- optimizes data performance
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
Click to expand...
Click to collapse
where do i find and change these? build.prop or elsewhere?
Originally Posted by metalspring
enable hardware acceleration
# Render UI through GPU instead of CPU
# Comment out if this causes laggy UI (it should speed up UI)
debug.sf.hw=1
disable sending usage data
ro.config.nocheckin=1
Click to expand...
Click to collapse
in build.prop?
Originally Posted by metalspring
Useful terminal emulator scripts run as superuser (su)
*Use swap partition without swapper2.
Add this script to the end of any file in the /etc/init.d folder. If you don't have one just run it in terminal emulator each reboot (or use the app script manager to make it run at boot. Script manager doesn't run continuously like swapper2)
swapon /dev/block/mmcblk0p3
And to turn swap off
swapoff /dev/block/mmcblk0p3
*Setting swappiness
Add or edit this line in the file etc/sysctl.config using whatever value you want, just keep the spaces (open in text editor)
vm.swappiness = 30
Or add this to the end of a script in init.d or run in terminal emulator
sysctl -w vm.swappiness=30
*Loading a module for apps2sdext (link2sd style apps2sd)
Run this in terminal emulator with superuser permission, substituting ext3 for whatever extension you want loaded (keep the .ko though)
insmod /system/lib/modules/ext3.ko
Click to expand...
Click to collapse
Can i make 2 scripts in script manager that can do this? or are there any available? I know on such a low ram & low internal storage device, swap and apps2sdext would be INCREDIBLY useful.. any tips on making this permanent? If i can make a script in SM i know i can set it start at boot. But i wouldn't need to do that for a2sdext right? once that's set, it's set and needs no changes right?
Also, would you suggest a custom rom like steeldroid or would i be better off stripping out the crapware from the stock ota rom (froyo) and just flashing a better compatible kernel and using some tweaks & scripts to speed things up a bit and optimize them for his purposes.
Let me know what you think?
thanks!
Click to expand...
Click to collapse
to the first 4 yes, just add them to the build.prop and for the last ones you can either use script manager to make a new script in the folder /system/etc/init.d
if you dont have an init.d folder then you have to have script manager to run them at boot (i'd suggest having the scripts in /data) and for apps2sdext, i'd suggest using the app link2sd, its basically the only way to control moving apps to the sdcard ext
also the biggest help for low ram devices is v6 supercharger and all the other zeppelinrox scripts
http://forum.xda-developers.com/showpost.php?p=18703418&postcount=5021
and i'd highly highly suggest steeldroid 10, its what i currently run and most of the tweaks i have in this thread are already included in it
and btw if you didnt know, in order to use swap and link2sd you have to format your sdcard and repartition it, the easiest way is installing rom manager, flashing clockwork recovery and there should be an option to partition your sdcard in rom manager (it will erase everything on your sdcard so back everything up)
also i'm going to update this thread with more stuff i've found
updated and cleaned up op
awesome! thanks! yea i know about partitioning the sdcard. I use both swap and a2ext on my htc g2, but they are part of the kernel on the ROM i run, i've never used any other software to initiate them.
Thanks for the tips!
Also, how can ANYONE flash roms from XDA and NOT know about the AMAZING supercharger v6 script!
first of all I want to thank the OP! being how this is not my phone but my brothers. he wants me to root it and install a rom. this thread made everything a whole lot simple.
now to bug you guys.. where can I find a suitable system recovery apk for this phone? I have one installed but it never boots into recovery. also I haz steel droid 10 running.
Sent from my DROID X2 using XDA App
motrinHD said:
first of all I want to thank the OP! being how this is not my phone but my brothers. he wants me to root it and install a rom. this thread made everything a whole lot simple.
now to bug you guys.. where can I find a suitable system recovery apk for this phone? I have one installed but it never boots into recovery. also I haz steel droid 10 running.
Sent from my DROID X2 using XDA App
Click to expand...
Click to collapse
if you're talking about a droid 1 then the instructions to root should install a custom recovery
If you're talking about a droid x2 as your signature suggests then I'd say try looking on droidforums.net... They are more dedicated to the droid series of android phones and I know any Motorola phone other than the droid 1 is more complicated because of a locked bootloader
You can try downloading rom manager to flash a recovery for either phone I believe
Also if you are already rooted and think you have a working recovery then try installing android terminal emulator from the market and typing in
su
reboot recovery
metalspring said:
if you're talking about a droid 1 then the instructions to root should install a custom recovery
If you're talking about a droid x2 as your signature suggests then I'd say try looking on droidforums.net... They are more dedicated to the droid series of android phones and I know any Motorola phone other than the droid 1 is more complicated because of a locked bootloader
You can try downloading rom manager to flash a recovery for either phone I believe
Also if you are already rooted and think you have a working recovery then try installing android terminal emulator from the market and typing in
su
reboot recovery
Click to expand...
Click to collapse
I am talking about the droid 1. tho I spf'd to 2.2 I then went with the one click root method. and it placed a system recovery apk on my sd but I find that it does not work. I'm going to try that emulator thing you suggested
Sent from my DROID X2 using XDA App
metalspring said:
to the first 4 yes, just add them to the build.prop and for the last ones you can either use script manager to make a new script in the folder /system/etc/init.d
if you dont have an init.d folder then you have to have script manager to run them at boot (i'd suggest having the scripts in /data) and for apps2sdext, i'd suggest using the app link2sd, its basically the only way to control moving apps to the sdcard ext
also the biggest help for low ram devices is v6 supercharger and all the other zeppelinrox scripts
http://forum.xda-developers.com/showpost.php?p=18703418&postcount=5021
and i'd highly highly suggest steeldroid 10, its what i currently run and most of the tweaks i have in this thread are already included in it
and btw if you didnt know, in order to use swap and link2sd you have to format your sdcard and repartition it, the easiest way is installing rom manager, flashing clockwork recovery and there should be an option to partition your sdcard in rom manager (it will erase everything on your sdcard so back everything up)
also i'm going to update this thread with more stuff i've found
Click to expand...
Click to collapse
MS,
I have learned alot from your posts. Thanks for the time spent sharing them. A few questions.
You mention and I have noticed many of the tweaks are already incorporated into Steel Droid X. (I am currently running the rc1 version with the last Deprimed Kernel.) Am am liking it ALOT!!.
Is there anyway you could somehow put a denotion on the tweaks that are already included in SDX? I think it would be helpful, as I certainly would find it so.
How much of a effect did you find running v6 supercharger had given the other changes already in SDX? Any conflicts or issues running it with this ROM?
I am planning on partitioning my SD card as I would like to try the benefits of a swap partition. Upon checking my usage I am considering a 128mb. Seems like a safe size all around. Believe you have posted this somewhere as well? Card is a 32g class 4. I have never messed with running a swap. Currently, I have a standard single FAT32 format part. I have a number of programs already set as loaded on the SD card so I will have to move those back.
I believe SDX has apps2sdext already, correct?
From your post I take I still need links2sd to have the apps to go to that swap partition?
Is there a good link to info on the hows, workings, etc on the swap partition, apps works? I can search for one, only if you happen to have a link handy.
Thanks for all your help.
BE

[MOD](UPDATED) For those with battery issues

please dont forget to thank
loSconosciuto
ilcorsaronero
PureMotive
credits to loSconosciuto for modifying this mod to our galaxy sl and most especially to ilcorsaronero for the modification and for making the universal cwm flashable zip for our device
ilcorsaronero said:
Since noone was updating it, I provide a working flashable zip basing on this mod. There were more than one problem in the zip, but now I fixed them. Please report:
* if you notice a battery performance improvement
* how much is this improvement
* which MOD are you on
* which KERNEL are you on. This mod works only on init.d featured mod/kernels.
thanks.
Flash this through CWM recovery!
Click to expand...
Click to collapse
link to cwm flashable zip file
http://forum.xda-developers.com/showpost.php?p=25536103&postcount=27
original thread of this mod
credits to PureMotive
PureMotive said:
Okay guys, I just thought I'd give you my mod for achieving good-great battery life. This is the mod I use in Anthem™ which has given me 50+ hours on a single charge. Feel free to include it in your own ROM or whatever. Giving credit would be nice
First: Here is a flashable .zip of the mod that may or may not work with your ROM. I'd still advise doing it manually.
Sysctl.conf​
Step 1
Open up your ROM.zip (or whatever it's called) in 7zip (Windows) or Betterzip (OSX) and locate
sysctl.conf in /system/etc
If it's not in this directory, create it.
Step 2
In your sysctl.conf file, paste the following code and save it.
Code:
#sysctl.conf file
fs.nr_open=1053696;
fs.inotify.max_queued_events=32000;
fs.inotify.max_user_instances=256;
fs.inotify.max_user_watches=10240;
fs.lease-break-time=10;
fs.file-max=165164;
kernel.threads-max=525810;
kernel.random.write_wakeup_threshold=256;
kernel.random.read_wakeup_threshold=128;
kernel.panic=5;
kernel.sched_compat_yield=1;
kernel.panic=0;
kernel.panic_on_oops=1;
kernel.msgmni=2048;
kernel.msgmax=64000;
kernel.shmmni=4096;
kernel.shmall=2097152;
kernel.shmmax=268435456;
kernel.sem='500 512000 64 2048';
kernel.sched_features=24189;
kernel.hung_task_timeout_secs=30;
kernel.sched_latency_ns=18000000;
kernel.sched_min_granularity_ns=1500000;
kernel.sched_wakeup_granularity_ns=3000000;
kernel.sched_shares_ratelimit=256000;
kernel.sched_child_runs_first=0;
fs.lease-break-time=10;
fs.file-max=65536;
net.core.wmem_max=524288;
net.core.rmem_max=524288;
net.core.rmem_default=262144;
net.core.wmem_default=262144;
net.core.optmem_max=20480;
net.unix.max_dgram_qlen=50;
net.ipv4.tcp_keepalive_time=900;
net.ipv4.tcp_keepalive_probes=5;
net.ipv4.tcp_keepalive_intvl=156;
net.ipv4.tcp_timestamps=0;
net.ipv4.tcp_sack=1;
net.ipv4.tcp_fack=1;
net.ipv4.tcp_window_scaling=1;
net.ipv4.tcp_tw_recycle=1;
net.ipv4.tcp_tw_reuse=1;
net.ipv4.tcp_congestion_control=cubic;
net.ipv4.tcp_syncookies=1;
net.ipv4.conf.all.rp_filter=1;
net.ipv4.conf.default.rp_filter=1;
net.ipv4.tcp_synack_retries=2;
net.ipv4.tcp_syn_retries=2;
net.ipv4.tcp_max_syn_backlog=1024;
net.ipv4.tcp_max_tw_buckets=16384;
net.ipv4.icmp_echo_ignore_all=1;
net.ipv4.icmp_ignore_bogus_error_responses=1;
net.ipv4.tcp_no_metrics_save=1;
net.ipv4.tcp_fin_timeout=15;
net.ipv4.tcp_keepalive_intvl=30;
net.ipv4.tcp_keepalive_probes=5;
net.ipv4.tcp_keepalive_time=1800;
net.ipv4.ip_forward=0;
net.ipv4.conf.default.accept_source_route=0 ;
net.ipv4.conf.all.accept_source_route=0;
net.ipv4.conf.all.accept_redirects=0;
net.ipv4.conf.default.accept_redirects=0;
net.ipv4.conf.all.secure_redirects=0;
net.ipv4.conf.default.secure_redirects=0;
net.ipv4.udp_rmem_min=6144;
net.ipv4.udp_wmem_min=6144;
net.ipv4.tcp_rfc1337=1;
net.ipv4.ip_no_pmtu_disc=0;
net.ipv4.tcp_ecn=0;
net.ipv4.route.flush=1;
net.ipv4.tcp_rmem='6144 87380 524288';
net.ipv4.tcp_wmem='6144 87380 524288';
net.ipv6.conf.default.use_tempaddr=2;
net.ipv6.conf.all.use_tempaddr=2;
net.ipv6.conf.all.temp_prefered_lft=3600;
net.ipv6.conf.default.temp_prefered_lft=3600;
vm.dirty_ratio=90;
vm.dirty_background_ratio=80;
vm.oom_kill_allocating_task=1;
vm.overcommit_memory=1;
vm.page-cluster=3;
vm.drop_caches=3;
vm.min_free_kbytes=4096;
vm.panic_on_oom=0;
vm.dirty_expire_centisecs=1000;
vm.dirty_writeback_centisecs=2000;
vm.oom_kill_allocating_task=0;
vm.vfs_cache_pressure=10;
vm.min_free_order_shift=4;
vm.laptop_mode=0;
vm.block_dump=0;
Step 3
Now we need to enable it. So, navigate to /system/etc/init.d and create a file with the following code:
Code:
#!/system/bin/sh
# grep sysctl /etc/init.d/*
# Load /sys/etc/sysctl.conf
sysctl -p
sysctl -p is what initializes the code.
Just FYI: You don't actually need these lines:
Code:
# grep sysctl /etc/init.d/*
Code:
# Load /sys/etc/sysctl.conf
So this would have just sufficed.
Code:
#!/system/bin/sh
sysctl -p
If the above code does not work for any reason, try this:
Code:
#!/system/bin/sh
sysctl -p /system/etc/
Name your file something like this 10sysctl
Save your file.
NOTE: Your ROM must support init.d. You can do this by using dsixda's android kitchen
Step 4
Save your ROM and install it via recovery
OR
you could just push the files into your current ROM and try them out.
----------- For knowledge -----------​
Credits to imoseyon for portions of the info​
Ok, so what exactly is sysctl.conf?
The sysctl.conf is a configuration file for "sysctl" which is an interface for dynamically changing kernel parameters in the Linux OS. The configuration file contains the following elements, vm.min_free_kbytes, vm.dirty_ratio, vm.dirty_backgroud_ratio, vm.vfs_cache_pressure, vm.oom_kill_allocating_task. There are many other elements within the file, but we will be primarily focusing on these specifically (the vm prefix stands for virtual memory). The sysctl.conf file should be located in /etc (/system/etc) by default. To enable it you need your ROM to execute "sysctl -p" somewhere during the boot process (or shortly afterward). We will also be discussing how to enable it if it is not already done so. You can also run sysctl -p manually to enable it any time after the OS is started.
Now, let’s get down to what sysctl.conf does and how it works.
min free kbytes (vm.min_free_kbytes)
This is used to force the Linux VM to keep a minimum number of kilobytes free. The VM uses this number to compute a pages_min value for each lowmem zone in the system. Each lowmem zone gets a number of reserved free pages based proportionally on its size. Default is 2048kb.
dirty ratio (vm.dirty_ratio) and dirty background ratio (vm.dirty_background_ratio)
This controls how often the kernel writes data to "disk" (in our case the internal microSD system card, not the removable microSD card). When your apps write data to disk, Linux actually doesn't write the data out to the disk right away, it actually writes the stuff to system memory and the kernel handles when and how the data is actually going to be flushed to the disk. These values represent a percentage, the higher the percentage, the longer it waits to flush, the lower the percentage, the more often flushes will occur. Now remember, we are dealing with solid state storage, not the traditional disk platter and spindle. So we are actually able to delay flushes a little longer with solid state versus a traditional hard drive disk.
VFS Cache Pressure
Now here is where it gets interesting! File system cache (dentry/inode) is really more important than the block cache above in dirty ratio and dirty background ratio, so we really want the kernel to use up much more of the RAM for file system cache, this will increas the performance of the system without sacrificing performance at the application level. The default value is 100, as a percentage, and what you want to do is lower the value to tell the kernel to favor the file system cache and not drop them aggressively.
oom allocating task (vm.oom_kill_allocating_task)(enable or disable, generally in Linux this value is either a "1" or a "0," representing as on or off.)
This enables or disables killing the OOM-triggering task in out-of-memory (oom) situations. If this is set to zero, or disabled, the OOM killer will scan through the entire task list and select a task based on heuristics to kill. This normally selects a rogue memory-hogging task that frees up a large amount of memory when killed. If this is set to non-zero, or enabled, the OOM killer simply kills the task that triggered the out-of-memory condition. This avoids the expensive task list scan, which can take mass amounts of time and "hang" or freeze the system.
block_dump (vm.block_dump)
This enables block I/O debugging when set to a nonzero value. If you want to find out which process caused the disk to spin up (see /proc/sys/vm/laptop_mode), you can gather information by setting the flag.
When this flag is set, Linux reports all disk read and write operations that take place, and all block dirtyings done to files. This makes it possible to debug why a disk needs to spin up, and to increase battery life even more. The output of block_dump is written to the kernel output, and it can be retrieved using "dmesg". When you use block_dump and your kernel logging level also includes kernel debugging messages, you probably want to turn off klogd, otherwise the output of block_dump will be logged, causing disk activity that is not normally there.
overcommit_memory (vm.overcommit_memory)
This controls overcommit of system memory, possibly allowing processes to allocate (but not use) more memory than is actually available.
0 - Heuristic overcommit handling. Obvious overcommits of address space are refused. Used for a typical system. It ensures a seriously wild allocation fails while allowing overcommit to reduce swap usage. root is allowed to allocate slighly more memory in this mode. This is the default.
1 - Always overcommit. Appropriate for some scientific applications.
2 - Don't overcommit. The total address space commit for the system is not permitted to exceed swap plus a configurable percentage (default is 50) of physical RAM. Depending on the percentage you use, in most situations this means a process will not be killed while attempting to use already-allocated memory but will receive errors on memory allocation as appropriate.
page-cluster (vm.page-cluster)
This controls the number of pages which are written to swap in a single attempt. The swap I/O size.
It is a logarithmic value - setting it to zero means "1 page", setting it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
The default value is three (eight pages at a time). There may be some small benefits in tuning this to a different value if your workload is swap-intensive.
panic_on_oom (vm.panic_on_oom)
This enables or disables panic on out-of-memory feature. If this is set to 1, the kernel panics when out-of-memory happens. If this is set to 0, the kernel will kill some rogue process, by calling oom_kill().
Usually, oom_killer can kill rogue processes and system will survive. If you want to panic the system rather than killing rogue processes, set this to 1.
The default value is 0.
Panic is a system error that is detected by the kernel.
dirty_expire_centisecs (vm.dirty_expire_centisecs)
How old "dirty" data should be before the kernel considers it old enough to be written to disk. It is expressed in 100ths of a second.
dirty_writeback_centisecs (vm.dirty_writeback_centisecs)
This is the interval of when the writeback daemons periodically wake up and write "old" data out to disk. It is expressed in 100ths of a second.
Click to expand...
Click to collapse
source:
http://forum.xda-developers.com/showthread.php?t=1621808
i use juice defender...with okayish usage, i got 3 days and 1 hour(1 time thing).....with my normal usage i get 24+ hours......
would have given this a try had there been just a .zip file
it comes with a zip file but flash at your own risk
Code:
http://www.androidfilehost.com/main/Incredible_Developers/PureMotive/Mods/Universal/Sysctl-conf.zip
i just saw this thread and see it really interesting as we all love longer battery life
it was classified as universal but i have not flashed file yet and am hoping first feedbacks about this from developers in our phone model
noypi_ako said:
it comes with a zip file but flash at your own risk
Code:
http://www.androidfilehost.com/main/Incredible_Developers/PureMotive/Mods/Universal/Sysctl-conf.zip
i just saw this thread and see it really interesting as we all love longer battery life
it was classified as universal but i have not flashed file yet and am hoping first feedbacks about this from developers in our phone model
Click to expand...
Click to collapse
I cannot flash it (status 0) in my MIUI 10.5...
tomjoad2 said:
I cannot flash it (status 0) in my MIUI 10.5...
Click to expand...
Click to collapse
Replace the meta-inf folder with the one in your rom zip file
Cheers
Sent from my GT-i9003 powered by Stable and Smooth CleanKpu rom
I had problems installing the zip on UC kernel stock rom. Nonetheless the kind of hack proposed in this mod should work here as well. It makes sense. Is anyone able to fix it?
it was mentioned by the developer that the best to do it is manually
and that custom rom developers can implement it on their roms
Those having status 0 error: replace the meta-inf folder in the flashable zip with the one in your rom
Cheers
Sent from my GT-i9003 powered by Stable and Smooth CleanKpu rom
bscraze said:
Those having status 0 error: replace the meta-inf folder in the flashable zip with the one in your rom
Cheers
Sent from my GT-i9003 powered by Stable and Smooth CleanKpu rom
Click to expand...
Click to collapse
thanks...done, but now I get error (status 7)
tryng to do it manually
i think it would be best if we hear feedbacks first from our kernel/rom developers of i9003
Even though sysctl.conf accepts ";", it breaks the conf file and sysctl can't parse it.
Use this instead:
http://pastebin.com/raw.php?i=3tDgbmG3
EDIT:
This file is simply the one in the OP without ";".
FYI some of its values overwrite the values used by kernel developers.
EDIT 2:
And without single quotes.
loSconosciuto said:
Even though sysctl.conf accepts ";", it breaks the conf file and sysctl can't parse it.
Use this instead:
http://pastebin.com/raw.php?i=3tDgbmG3
Click to expand...
Click to collapse
Done manually... but when I try to review with sysctl -a| grep vm cannot see any changes
tomjoad2 said:
Done manually... but when I try to review with sysctl -a| grep vm cannot see any changes
Click to expand...
Click to collapse
Sorry, I didn't notice the single quotes in sysctl.conf
File updated (same link).
loSconosciuto said:
Sorry, I didn't notice the single quotes in sysctl.conf
File updated (same link).
Click to expand...
Click to collapse
Still nothing...maybe sysctl -p cannot activate the script...
tomjoad2 said:
Still nothing...maybe sysctl -p cannot activate the script...
Click to expand...
Click to collapse
deeper part of the first post
developer said if this dont work
Code:
#!/system/bin/sh
sysctl -p
then try this
Code:
#!/system/bin/sh
sysctl -p /system/etc/
tomjoad2 said:
Still nothing...maybe sysctl -p cannot activate the script...
Click to expand...
Click to collapse
It should work. Maybe you don't have /etc, but only /system/etc (/etc is just a symlink)
If you run
Code:
sysctl -p
you should get as output the content of sysctl.conf
If you get
Code:
sysctl: /etc/sysctl.conf: No such file or directory
Try with
Code:
sysctl -p /PATH/TO/THE/FILE/sysctl.conf
Where /PATH/TO/THE/FILE/ is, of course, the path to sysctl.conf,
noypi_ako said:
deeper part of the first post
developer said if this dont work
Code:
#!/system/bin/sh
sysctl -p
then try this
Code:
#!/system/bin/sh
sysctl -p /system/etc/
Click to expand...
Click to collapse
This is what I get
and when a write sysctl -p then ---> sysctl: short write
tomjoad2 said:
This is what I get
and when a write sysctl -p then ---> sysctl: short write
Click to expand...
Click to collapse
i believe loSconosciuto is highly qualified for this one
many thanks to him for looking into this mod
Code:
ls -l /proc/sys/net/ipv4/route/flush
--w------- 1 root root 0 Apr 28 14:26 /proc/sys/net/ipv4/route/flush
That means no one can read the content of this file, even 'root'. That's why you get
Code:
sysctl: error reading key 'net.ipv6.route.flush': Permission denied
sysctl: error reading key 'net.ipv4.route.flush': Permission denied
sysctl tries to read it, but it can't.
tomjoad2 said:
This is what I get
and when a write sysctl -p then ---> sysctl: short write
Click to expand...
Click to collapse
Are you sure your sysctl.conf is correct? Did you remove all the ";" and "'"?
loSconosciuto said:
Code:
ls -l /proc/sys/net/ipv4/route/flush
--w------- 1 root root 0 Apr 28 14:26 /proc/sys/net/ipv4/route/flush
That means no one can read the content of this file, even 'root'. That's why you get
Code:
sysctl: error reading key 'net.ipv6.route.flush': Permission denied
sysctl: error reading key 'net.ipv4.route.flush': Permission denied
sysctl tries to read it, but it can't.
Are you sure your sysctl.conf is correct? Did you remove all the ";" and "'"?
Click to expand...
Click to collapse
would it work if we chmod 644 those file?

Getting the Most Out of Your Nexus 7: Jay's Recipe for Buttery Goodness (4.1.2/4.2+)

Getting the Most Out of Your Nexus 7
Jay's Recipe for Buttery Goodness
for Android 4.1.2/4.2/4.2.1​
What we're going to do here is remount /data and /cache with discard and noauto_da_alloc, disable fsync, enable a 128mb zRAM and setup a good, stable starting point for further modification. The result is a stable, considerably smoother multitasking powerhouse with overall better power management and performance.
This recipe will work on pretty much any 4.1.2 ROM, and instructions are given for stock-based (with and without init.d support) and CM-based ROMs. If you have any questions, comments, or suggestions, please leave them below. I'll be happy to address whatever I can in a timely manner
[Common] Determining which script to use:
Download: SecretSauce4.1.2.zip - Contains 4 scripts. Unzip and choose which one you want
This all depends on how much you multitask (how many different things you do at once). If you usually have 4 or 5 apps open that you switch between regularly, then you do a moderate amount of multitasking, and would choose the 256mb script. If you tend to do only one thing at a time, you may decide to save the RAM and run with no zRAM. That's fine, too (I've even got a script for that, it's a favorite among gamers ). If you feel you fall somewhere in between, there are 64mb and 128mb scripts, as well.
If in doubt, try each for a day or two. Decide for yourself (and let me know what you find). Feel free to modify the script to suit you. If you don't understand anything in there, don't worry about it. It's set up pretty well as-is, and the defaults should suit you fine.
Please read this post to help you decide which script to install
[Common] To init.d or not to init.d:
If you run a custom ROM that supports /system/etc/init.d/ (and sometimes even /data/local/userinit.d), then you definitely want to go the init.d route, as it's pretty much bulletproof and needs virtually no resources to operate - it's built-in to the system.
If your ROM is stock-based, it probably doesn't support init.d - but it might. Ask the developer of your ROM if it has init.d support (and then let me know ). This recipe can be done on stock with init.d support! I include a link to a stock 4.1.2 kernel with init.d support in the ramdisk that you can flash before the M-Kernel Plus. Then just create /system/etc/init.d, chmod it 0755, and drop your script in there.
If your ROM is CyanogenMod (CM) based, then not only does it have init.d support, it has userinit.d support, which is great because it persists between dirty flashes. userinit.d is a directory you create in /data/local and chmod 0755. Any script you put in there (chmod 0755) will be run as it would were it in /system/etc/init.d
If you're completely stock but rooted (hey, it happens), and you want the buttery goodness but you don't want to flash a kernel - don't fret! I've even included a way for you to get what you can from the recipe! You'll be using an app called Script Manager (it's free, but you can donate, too. It's totally worth it) to autoload the script at boot-time. A couple of extra steps, but absolutely no mucking around under the hood
Personally, whether I'm on stock or something CM-based, I prefer having init.d (and userinit.d) support, as like I said, it's pretty much bulletproof and requires no extra resources. I, myself, run ParanoidAndroid 2.23, which is CM-based. It's the best-running, sturdiest, most usefully customized ROM I have ever used on any device, and I can't recommend it enough. Team Paranoid Android is top-notch!
...Now that you've decided on, flashed, setup and customized a ROM (or maybe you stayed stocked)...
BEYOND THIS POINT, THERE BE DRAGONS!
I'm not responsible if you FUBAR your device. But, if you follow my directions and pay attention to what you're doing, you won't.​This tutorial assumes basic knowledge of the Android operating system, related terminology, and the most basic of Linux understanding. Any term I use in this guide can be quickly and easily Googled.​
[Stock, rooted, no init.d] Installing the Special Sauce script and Script Manager:
* Open the Play Store and get the Stericson's Busybox Installer and install it
* Run the program, let it boot up and figure out what's where (takes a bit)
* Install Busybox 1.20.2 to /system/xbin
* Create /sdcard/scriptinit.d
* Copy the script you decided on into /sdcard/scriptinit.d
* Open the Play Store and get Script Manager and install it
* Run Script Manager, find your script, load it up, click the little root icon, and set it to run at boot
* Close Script Manager
* Skip to [Common (except CM-based)] Install M-Kernel Plus
[Stock, has init.d] Installing the Special Sauce script:
* Open the Play Store and get the Stericson's Busybox Installer and install it
* Run the program, let it boot up and figure out what's where (takes a bit)
* Install Busybox 1.20.2 to /system/xbin
* Copy the script you decided on into /system/etc/init.d/ and chmod it 0755
* Skip to [Common (except CM-based)] Install M-Kernel Plus
[Stock, needs init.d] Installing the Special Sauce script and creating init.d:
Download:Nexus7Stock_Insecure_InitD_4.1.2.zip by Metallice
* Reboot into recovery
* Flash Nexus7Stock_Insecure_InitD_4.1.2.zip
* Go to advanced and fix permissions
* Go back and reboot system
* Open the Play Store and get the Stericson's Busybox Installer and install it
* Run the program, let it boot up and figure out what's where (takes a bit)
* Install Busybox 1.20.2 to /system/xbin
* If /system/etc/init.d/ does not exist, create it, and make sure it's chmod 0755
* Copy the script you decided on into /system/etc/init.d/ and chmod it 0755
* Skip to [Common (except CM-based)] Install M-Kernel Plus
[CM-Based] Installing the ramdisk, M-Kernel Plus and Special Sauce script:
CM really should have busybox. If it doesn't, install it.
Download: Nexus7_CM10_PA22_4.1.2_complete.zip
and
the M-Kernel Plus of your choice from Metallice's M-Kernel Classic/Plus thread
* Reboot into recovery
* Flash Nexus7_CM10_PA22_4.1.2_complete.zip
* Go to advanced and fix permissions
* Go back and flash the M-Kernel Plus you downloaded
* Go to advanced and fix permissions again
* Go back and reboot system
* If /data/local/userinit.d/ does not exist, create it and chmod it 0755
* Copy the script you decided on into /data/local/userinit.d/ and chmod it 0755
* Skip to [Common] Verifying Installation
[Common (except CM-based)] Install M-Kernel Plus
Download: the M-Kernel Plus of your choice from Metallice's M-Kernel Classic/Plus thread
* Reboot into recovery
* Flash M-Kernel_alpha1_446GPU.zip
* Go into advanced and fix permissions
* Go back and reboot system
* Profit - You're done!
[Common] Verifying Installation
Pretty easy to verify if it's working. First off, it'll be really fast and snappy! Second, if you're using zRAM, you can open a terminal or adb shell from your PC and
free
The last line it outputs will be for swap (this is actually your compressed zRAM). For total and free, there should be numbers. If there are, then you have a page file and it's working.
Finally, you can open a terminal or adb shell from your PC and
mount | grep discard
It should output 2 lines, one for /data and one for /cache. That means it's working.
[Common] Further Optimization:
I recommend the Play Store app System Tuner for further customization. The customizations I recommend are
* Undervolt the entire system by -50mV
* Try that for a day or two and then try another -25mV
* If you end up stable at -75mV, leave it be. That's a good unvervolt
* CPU Governor should be set to either interactive or ondemand, unless you're a hardcore gamer, in which case you might want to use performance
* CPU Frequencies can be set. I use 100-1300. Use whatever floats your boat
* I/O Scheduler can be specified. I recommend deadline in every situation, as it's specially modified by _motley
* Go to Boot Settings from any of those screens, and save cpu and sd via the 'on boot complete' or init.d method (if you chose not to implement init.d, choose upon boot completion).
* Back out of System Tuner and reboot
* Profit
Feel free to take it from there, and post your experiences here
Just In Case
Update 11/10/2012
If you are using kernel a6 or better, you don't need to flash any other kernel or ramdisk zip first. Starting with a6, Metallice compiles his own universally-compatible ramdisk.
I'll try it, Thank you. Your 4.1.1 recipe was awesome
I loved your guide for 4.1.1. Thank you very much for updating it to 4.1.2
Thanks for the guide
Btw my swap says 0 in every one, I am using the 128mb script, shouldn't be 128 in swap?
I can confirm swap is 0. The funny thing is that mkswap and swapon actually work at boot, I can see from dmesg, but swap gets disabled by something. If you just run swapon again, it activates and stays.
Sent from my Nexus 7 using xda app-developers app
kzakhar said:
I can confirm swap is 0. The funny thing is that mkswap and swapon actually work at boot, I can see from dmesg, but swap gets disabled by something. If you just run swapon again, it activates and stays.
Sent from my Nexus 7 using xda app-developers app
Click to expand...
Click to collapse
Ditto here - even tried renaming to S90SecretSauce128 - PA 2.23
sizanx said:
Thanks for the guide
Btw my swap says 0 in every one, I am using the 128mb script, shouldn't be 128 in swap?
Click to expand...
Click to collapse
kzakhar said:
I can confirm swap is 0. The funny thing is that mkswap and swapon actually work at boot, I can see from dmesg, but swap gets disabled by something. If you just run swapon again, it activates and stays.
Sent from my Nexus 7 using xda app-developers app
Click to expand...
Click to collapse
Ryan Kasper said:
Ditto here - even tried renaming to S90SecretSauce128 - PA 2.23
Click to expand...
Click to collapse
Can you guys confirm whether the script is running at all? What are the results of
mount | grep discard
?
Not so sure zram is worth the loss of actual ram.
Maybe a swap partition would be more useful, although is that worth potential damage to the internal SD.
With the S3 you can set it to use the external storage so if that gets damaged from too many read/write operations an sdcard is cheap to replace.
Unfortunately we don't have that option with the N7.
Not trying to be negative, just throwing out some ideas to see what you think.
256mb+ swap partition on internal SD?
Sent from my GT-I9300 using xda premium
nodstuff said:
Not so sure zram is worth the loss of actual ram.
Maybe a swap partition would be more useful, although is that worth potential damage to the internal SD.
With the S3 you can set it to use the external storage so if that gets damaged from too many read/write operations an sdcard is cheap to replace.
Unfortunately we don't have that option with the N7.
Not trying to be negative, just throwing out some ideas to see what you think.
256mb+ swap partition on internal SD?
Sent from my GT-I9300 using xda premium
Click to expand...
Click to collapse
It's worth it if you do a fair amount of multitasking. I have mine set at 128, but if I'm gonna be doing heavy gaming, I'll disable it, temporarily. Haven't run into any memory issues.
Jay Aristide said:
It's worth it if you do a fair amount of multitasking. I have mine set at 128, but if I'm gonna be doing heavy gaming, I'll disable it, temporarily. Haven't run into any memory issues.
Click to expand...
Click to collapse
But isn't that zram, which is basically taking some normal ram and compressing it and using it as swap?
Would it make sense to leave normal ram as is and to make a swap partition on the internal SD and have 1gb of ram, plus whatever size you make the swap partition.
I know it would be slightly slower than zram but we would end up with over 1gb of usable 'ram'
The only downside is the potential damage to the SD card which is why using zram is safer, but the downside to zram is loss of some normal ram.
There's pro's and con's to both really.
Sent from my GT-I9300 using xda premium
Jay Aristide said:
Can you guys confirm whether the script is running at all? What are the results of
mount | grep discard
?
Click to expand...
Click to collapse
Here you go.
Code:
[email protected]:/ $ mount | grep discard
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
[email protected]d:/ $
sizanx said:
Here you go.
Code:
[email protected]:/ $ mount | grep discard
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
[email protected]:/ $
Click to expand...
Click to collapse
Okay, do me a favor and reboot your tablet. Once it's up and going, do
uname -a ; free ; mount | grep discard
And tell me the results
Jay Aristide said:
Can you guys confirm whether the script is running at all? What are the results of
mount | grep discard
?
Click to expand...
Click to collapse
Code:
mount | grep discard
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
nodstuff said:
But isn't that zram, which is basically taking some normal ram and compressing it and using it as swap?
Would it make sense to leave normal ram as is and to make a swap partition on the internal SD and have 1gb of ram, plus whatever size you make the swap partition.
I know it would be slightly slower than zram but we would end up with over 1gb of usable 'ram'
The only downside is the potential damage to the SD card which is why using zram is safer, but the downside to zram is loss of some normal ram.
There's pro's and con's to both really.
Sent from my GT-I9300 using xda premium
Click to expand...
Click to collapse
Well, the point of it is to improve performance while multitasking by storing the page file in memory. I've played around with nand swap on other devices, and I've never been impressed with it on Android, whereas app-switching is noticeably snappier using zRam.
Either way, there's a no zRam version, and 3 different sizes to choose from, so just find what works for you and lemme how what you settled on
Jay Aristide said:
Okay, do me a favor and reboot your tablet. Once it's up and going, do
uname -a ; free ; mount | grep discard
And tell me the results
Click to expand...
Click to collapse
Code:
uname -a ; free ; mount | grep discard
Linux localhost 3.1.10-motley+ #51 SMP PREEMPT Mon Oct 15 14:37:13 EDT 2012 armv7l GNU/Linux
total used free shared buffers
Mem: 996780 969476 27304 0 51544
-/+ buffers: 917932 78848
Swap: 0 0 0
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
Ryan Kasper said:
Code:
uname -a ; free ; mount | grep discard
Linux localhost 3.1.10-motley+ #51 SMP PREEMPT Mon Oct 15 14:37:13 EDT 2012 armv7l GNU/Linux
total used free shared buffers
Mem: 996780 969476 27304 0 51544
-/+ buffers: 917932 78848
Swap: 0 0 0
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
Click to expand...
Click to collapse
What ROM are you running, if any?
Also, could you please
cat /sys/block/zram0/disksize
And report the results?
Jay Aristide said:
Well, the point of it is to improve performance while multitasking by storing the page file in memory. I've played around with band swap on other devices, and I've never been impressed with it on Android, whereas app-switching is noticeably snappier using zRam.
Either way, there's a no zRam version, and 3 different sizes to choose from, so just find what works for you and lemme how what you settled on
Click to expand...
Click to collapse
Ya you're right, I'm just apprehensive of zram from the S3, before jellybean it only had 778mb of usable ram and with a 128mb zram swap then you were down to 650mb.
But the N7 doesn't have that problem so zram is probably the better option for the N7.
I'll take the no zram one for a test drive first and try each one after that and I'll report back.
Thanks man.
Sent from my GT-I9300 using xda premium
Jay Aristide said:
What ROM are you running, if any?
Also, could you please
cat /sys/block/zram0/disksize
And report the results?
Click to expand...
Click to collapse
Paranoid 2.23
Code:
cat /sys/block/zram0/disksize
134217728
Jay Aristide said:
What ROM are you running, if any?
Also, could you please
cat /sys/block/zram0/disksize
And report the results?
Click to expand...
Click to collapse
I posted earlier: zram device is created ok, mkswap works ok, even swapon works ok, but then swap gets turned off by something. If later I run swapon again, swap comes back, meaning both zram device and mkswap worked fine.
I'm also using PA 2.23 with Metallice alpha kernel.

[LOS][SWAP][MEM] Snappier than ever

NOTE: BEFORE SAYING "yet another memory swapping evangelist", WATCH THE VIDEO: https://youtu.be/sdeKuPiR4II
I have been doing some research on system responsiveness with my good old Mofo Z. Then arrived at this.
24 hours after having configured:
LineageOS 15.1 (root enabled)
Swap file size = 4GB (in /data/swap)
vm.swap_ratio = 100 (default)
vm.swap_ratio_enable = 1
vm.swappiness = 75
I have achieved the readings contained in the attached screenshots, and the system acts snappier than ever. It's actually running pretty cool.
First I enabled init.d processing by adding an RC file to init, then created userinit.sh with the necessary systcl and swapon commands.
No system files were changed (new files were added only), so after an update the configuration won't revert to the original state (swap-less).
The least used pages (some [almost] never used) are being written to the swap file and therefore more room for active code (and cached apps) is made available.
It's almost like I had an 8GB RAM bastard in my hand. This with around 130 apps loaded.
STEPS USED
File init_d.rc was created (as described in https://forum.xda-developers.com/lineage/general/how-to-enable-init-d-to-function-t3810355)
Executed:
Code:
$ su
# cd /data
# mkdir swap
# cd swap
# dd if=/dev/zero of=swapfile bs=1048576 count=4096
# mkswap swapfile
Created /data/local/userinit.sh (called from within already existing /system/etc/init.d/90userinit) with the code:
Code:
#!/system/sbin/sh
# vm_swap_ratio=100 is default, no need to set
sysctl vm.swap_ratio_enable=1
sysctl vm.swappiness=75
swapon /data/swap/swapfile
Rebooted and let the system run for a few hours. Things only get better with uptime/usage.
The best part is that you can unroot afterwards and have it still working.
Merry Christmas!
thanx 4 ur work but i m newbie i dont understand what is for , what makes this for this device
murteci said:
thanx 4 ur work but i m newbie i dont understand what is for , what makes this for this device
Click to expand...
Click to collapse
It's for making your device multitasking better. Watch the video: https://youtu.be/sdeKuPiR4II
Guess what? The Galaxy Note 9 (SM-N9600, 6GB/128GB version) employs memory swapping. It has a 2GB active swap file right out of the box.
I received mine last friday, updated Android and went to check it out after I noticed it behaved and reported much like LineageOS with my mod applied. Then I installed a terminal emulator (no root needed) and ran "free -m".
Bang! The swapping is there!
Can't wait to root it and verify that the swappiness is set to... 75. Kinda keen those Samsung guys, huh? Heheheh.
Whammamoosha said:
Guess what? The Galaxy Note 9 (SM-N9600, 6GB/128GB version) employs memory swapping. It has a 2GB active swap file right out of the box.
I received mine last friday, updated Android and went to check it out after I noticed it behaved and reported much like LineageOS with my mod applied. Then I installed a terminal emulator (no root needed) and ran "free -m".
Bang! The swapping is there!
Can't wait to root it and verify that the swappiness is set to... 75. Kinda keen those Samsung guys, huh? Heheheh.
Click to expand...
Click to collapse
Can Make this tutorial to Video Tutorial on Youtube ?
Whammamoosha said:
It's for making your device multitasking better. Watch the video:
Click to expand...
Click to collapse
it looks fantastic, but does it wear the internal storage after time?
JuniorCaesar said:
it looks fantastic, but does it wear the internal storage after time?
Click to expand...
Click to collapse
Yes it does, everything is a trade-off, there's no such thing as a free lunch.
But the wear level added is roughly same as on a computer SSD, so we're talking about decades of use before everything wears out.
emrebozkurt99 said:
Can Make this tutorial to Video Tutorial on Youtube ?
Click to expand...
Click to collapse
I could, but everything is so simple that it's pretty unnecessary.
. Install terminal emulator app from Play Store
. Run terminal emulator app
. Type "free -m"
. Done!
As for the swap configuration for LOS I'm writing a shell script (BIG) that will handle the configuration as user-friendly as possible. Stay tuned!
Could this be used on a stock rom as well?
SlashSpeed said:
Could this be used on a stock rom as well?
Click to expand...
Click to collapse
This is for LineageOS. For stock ROMs (once rooted) one may make the necessary adaptions.
im noob
Hi, im noob and I followed your instructions (at least what I understood) n_nU
I hope that I did it right, the question is, how can I know that?
old thread, but this may not work for most because the script has a slight error:
Code:
#!/system/sbin/sh
It should be:
Code:
#!/system/bin/sh
then all is well.
justle said:
im noob
Hi, im noob and I followed your instructions (at least what I understood) n_nU
I hope that I did it right, the question is, how can I know that?
Click to expand...
Click to collapse
https://gist.github.com/iGlitch/be70d403ad1cfa42ac7e1d46f1b546db Amend a script to a script to track whether or not it executes. Note: You need to manually create the log folder and logs file in /storage/emulated/0 in order for it to work.
Code:
# Push a semi-needed log to the internal storage with a "report" if the script could be executed or not;
# Script log file location
LOG_FILE=/storage/emulated/0/logs
echo $(date) > /storage/emulated/0/logs/script.log
if [ $? -eq 0 ]
then
echo "Script executed. Enjoy!" >> /storage/emulated/0/logs/script.log
exit 0
else
echo "Script failed!" >> /storage/emulated/0/logs/script.log
exit 1
fi
# Done!
Thanks! Worked like a charm.
I use a bunch of fat apps and this caused a few seconds of load times with almost every app switch.
I'm running LOS 17.1 on gemini with 3GB RAM; swap file defaults to 0.5GB.
I've left
Code:
vm.swap_ratio_enable = 0
vm.swappiness = 60
as it was. Simply adding a new 4GB swap file fixed my daily pain.
I have to provide an update on the charm part. (I've tried other settings from first post too).
Previously system was stuck at fully utilized 500 MB default swap. Every app change (I'm using hungry ones) was a pain.
Now system uses ~300 MB more in swap, and for some use cases user experienced have gotten bettter.
I don't feel like this mode would be complete without changing app killer configuration. Would it even be efficient considering the memory read speed in mi5 (or at all)? Idk.
Bottom line.
If you are unhappy with the performance of your hardware and it's because of RAM and your system are using 100% of swap, then it is probably worth increasing the paging file size.
SyraAB said:
Thanks! Worked like a charm.
I use a bunch of fat apps and this caused a few seconds of load times with almost every app switch.
I'm running LOS 17.1 on gemini with 3GB RAM; swap file defaults to 0.5GB.
I've left
Code:
vm.swap_ratio_enable = 0
vm.swappiness = 60
as it was. Simply adding a new 4GB swap file fixed my daily pain.
Click to expand...
Click to collapse
Hi SyraAB.
I am glad that you successfully create swap and make swap service work, which I think now you are the only one who can solve my problems.
So I did every step that Whammamoosha said. However, I failed. When I check whether there was swap created using free -m in Termux there was nothing. Then I dig something out from some research. Here is my question:
1)
Whammamoosha said:
Created /data/local/userinit.sh (called from within already existing /system/etc/init.d/90userinit) with the code:
Click to expand...
Click to collapse
It appears that I don't have file 90userint under /system/etc/init.d (by the way I believe Whammamoosha meant /system/etc/init here because init.d does not exist in android). Also I notice your ROM is Lineage OS 17.1, which is the same as mine. So I am curious how did you make that work without file 90userinit.
2)
To my best knowledge that sysinit is killed in Los 17.1. There is a post on Reddit regarding to enable init.d on Los 17.1. Link is here. What makes me more curious is that how did you manage to make all things work without some key files? If you don't mind could you tell me how did you successfully create swap?
My phone is HTC m8 running on Lineage os 17.1.
Thanks in advance
Hello mrdet,
I didn't configure applying new swap on startup at all, so I didn't dance around absent init.d.
Increasing the paging file consist of two steps.
1. Create a file to be used as swap. This needs to be done once, as file persist after reboot.
Spoiler: mkswap example
Bash:
cd /data
mkdir swap
cd swap
# create swap file
dd if=/dev/zero of=swapfile bs=1048576 count=4096
mkswap swapfile
2. Activate it. This needs to be done after every reboot.
Spoiler: swapon example
Bash:
swapon /data/swap/swapfile
Hope this helps.

Categories

Resources