Android Tablets Forum banner
41 - 58 of 58 Posts

·
Registered
Joined
·
58 Posts
Just found this thread. Had posted in the other thread that the minfree number (the 2nd one, in particular) seemed out of place since it was larger than so lower priority ones.

I have the following:
cat /sys/module/lowmemorykiller/parameters/minfree
1536,2048,5632,6144,6656,6656

cat /sys/module/lowmemorykiller/parameters/adj
0,3,5,7,14,15

echo 0>/proc/sys/vm/oom_kill_allocating_task
echo 0>/proc/sys/vm/panic_on_oom
sysctl -w kernel.panic_on_oops=1
sysctl -w kerenel.panic=0

This seems to work great for me. The interpretation is that when free memory is below 6656 pages, we start killing empty and secondary server apps. At 6144 pages we start killing perceptables, at 2048 we start kicking visible and at 1536 the foreground app will have to be pushed out.

If you want to test this, it is possible to just push the numbers into the minfree (which is not persistent) or you can use the V6 SuperCharger script at http://forum.xda-developers.com/showthread.php?t=991276 -- Note the link about "Latest files" near the top. I am using Version 9. You can find what it changes in /system/etc/init.d and /data.
 

·
FW Developer
Joined
·
745 Posts
Discussion Starter · #42 ·
Just found this thread. Had posted in the other thread that the minfree number (the 2nd one, in particular) seemed out of place since it was larger than so lower priority ones.

I have the following:
cat /sys/module/lowmemorykiller/parameters/minfree
1536,2048,5632,6144,6656,6656

cat /sys/module/lowmemorykiller/parameters/adj
0,3,5,7,14,15

echo 0>/proc/sys/vm/oom_kill_allocating_task
echo 0>/proc/sys/vm/panic_on_oom
sysctl -w kernel.panic_on_oops=1
sysctl -w kerenel.panic=0

This seems to work great for me. The interpretation is that when free memory is below 6656 pages, we start killing empty and secondary server apps. At 6144 pages we start killing perceptables, at 2048 we start kicking visible and at 1536 the foreground app will have to be pushed out.

If you want to test this, it is possible to just push the numbers into the minfree (which is not persistent) or you can use the V6 SuperCharger script at http://forum.xda-developers.com/showthread.php?t=991276 -- Note the link about "Latest files" near the top. I am using Version 9. You can find what it changes in /system/etc/init.d and /data.
Great thanks for the info! As mentioned here these settings can use some adjustment. If we can get a couple people to test and can replicate improvement we will make permanent.
 

·
FW Developer
Joined
·
745 Posts
BUT if a kernel dev releases a new kernel we don't get boot.img-kernel.gz we get a zimage of the kernel.

Put the boot.img that you want to put the kernel in the bootimg directory
unpack with perl unpack-bootimg.pl boot.img
move boot.img-ramdisk to the boot diretory
place the zimage in the bootimg/boot directory
cd boot
repack new zimage into boot.img with perl ./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img
 

·
Registered
Joined
·
58 Posts
Great thanks for the info! As mentioned here these settings can use some adjustment. If we can get a couple people to test and can replicate improvement we will make permanent.
Then, too, this may be one of those personal preference things. If you let it kill earlier (higher numbers at the start) you get more memory for things to run, but it is more likely that when you switch back to, say, Opera, that it will reload because it got clobbered.

AMM (in the market) lets you adjust this graphically although the V6 script apparently does other things too. It also has a nice show of what programs are at what levels, etc.
 

·
Registered
Joined
·
2 Posts
Just finishing up software engineering internship.. looking to get my hands on something different while my brain is still in Java mode. Comfortable with linux, eclipse, java .. etc...
 

·
TeamDRH
Joined
·
981 Posts
Just finishing up software engineering internship.. looking to get my hands on something different while my brain is still in Java mode. Comfortable with linux, eclipse, java .. etc...
Good job. How are you with compiling Android kernel and drivers?
 

·
Registered
Joined
·
65 Posts
I've found the following script for tuning memory management as well tcp and other..

Code:
<br />
#!/bin/bash<br />
# Tweaks for Hannspad  v0.2<br />
# by Archimed<br />
<br />
# Tweaks RAM"<br />
echo 1536,3072,5632,6144,7168,7168 > /sys/module/lowmemorykiller/parameters/minfree;<br />
echo 0,3,5,7,14,15 > /sys/module/lowmemorykiller/parameters/adj;<br />
echo 0 > /sys/module/lowmemorykiller/parameters/debug_level;<br />
echo 64 > /sys/module/lowmemorykiller/parameters/cost;<br />
<br />
echo 0 >/proc/sys/vm/oom_kill_allocating_task<br />
echo 0 >/proc/sys/vm/panic_on_oom<br />
sysctl -w kernel.panic_on_oops=1<br />
sysctl -w kerenel.panic=0<br />
<br />
#Sdcache speedup sd read<br />
echo 1024 > /sys/devices/virtual/bdi/179:16/read_ahead_kb;<br />
echo 1024 > /sys/devices/virtual/bdi/179:24/read_ahead_kb;<br />
<br />
echo 0 > /proc/sys/vm/swappiness;<br />
<br />
#gives more mem to cache fs dentry and inode to save cpu<br />
echo 10 > /proc/sys/vm/vfs_cache_pressure;<br />
<br />
<br />
echo 65 > /proc/sys/vm/dirty_ratio;<br />
echo 10 > /proc/sys/vm/dirty_background_ratio;<br />
<br />
<br />
#echo 20480 > /proc/sys/vm/min_free_kbytes;<br />
#page-cluster controls the number of pages which are written to swap in a single attempt<br />
echo 0 > /proc/sys/vm/page-cluster;<br />
<br />
echo 15 >/proc/sys/fs/lease-break-time;<br />
#specifies the grace period (in seconds) that the kernel grants to a process holding a file lease after it has sent a signal to that process notifying it that another process is waiting to open the file<br />
<br />
<br />
echo 10000000 > /proc/sys/kernel/sched_latency_ns;<br />
echo 2000000 > /proc/sys/kernel/sched_min_granularity_ns;<br />
echo 760000 > /proc/sys/kernel/sched_wakeup_granularity_ns;<br />
echo 1 > /proc/sys/vm/oom_kill_allocating_task;<br />
<br />
#TCP tweak<br />
echo 0 > /proc/sys/net/ipv4/tcp_timestamps;<br />
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse;<br />
echo 1 > /proc/sys/net/ipv4/tcp_sack;<br />
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle;<br />
echo 1 > /proc/sys/net/ipv4/tcp_window_scaling;<br />
echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes;<br />
echo 30 > /proc/sys/net/ipv4/tcp_keepalive_intvl;<br />
echo 25 > /proc/sys/net/ipv4/tcp_fin_timeout;<br />
echo 404480 > /proc/sys/net/core/wmem_max;<br />
echo 404480 > /proc/sys/net/core/rmem_max;<br />
echo 256960 > /proc/sys/net/core/rmem_default;<br />
echo 256960 > /proc/sys/net/core/wmem_default;<br />
echo 4096 16384 404480 > /proc/sys/net/ipv4/tcp_wmem;<br />
echo 4096 87380 404480 > /proc/sys/net/ipv4/tcp_rmem;<br />
<br />
setprop wifi.supplicant_scan_interval 400;<br />
<br />
#better scrolling speed through lists<br />
setprop windowsmgr.max_events_per_sec 65;<br />
<br />
## disable touch below 60 pixels<br />
#setprop mot.proximity.delay 60;<br />
<br />
<br />
# NEVER kill the launcher, speedup Home return but less free memory<br />
echo -17 > /proc/`pidof com.android.launcher`/oom_adj;<br />
<br />
#remounting file systems with noatime nodiratime flags ,save battery and CPU<br />
for x in $(busybox mount | cut -d " " -f3);<br />
do<br />
	if [ "$x" != "/acct" ] &&  [ "$x" != "/dev/cpuctl" ]; then<br />
		sync;<br />
		echo $x;<br />
		log -p i -t remount_volume "remount $x noatime nodiratime";<br />
		busybox mount -o remount,noatime,nodiratime $x;<br />
	fi<br />
done;	<br />
	<br />
#flags every mounted partition as non rotational and increases it's cache size for more read speed<br />
array=("/sys/block/mtdblock3" "/sys/block/mtdblock7" "/sys/block/mmcblk3" "/sys/block/mtdblock4" "/sys/block/mtdblock0" );<br />
len=${#array[*]};<br />
i=0;<br />
while [ $i -lt $len ];<br />
do<br />
	rep=${array[$i]};<br />
	echo 0 > $rep/queue/rotational;<br />
	echo 1024 > $rep/queue/read_ahead_kb;<br />
	echo 512 > $rep/queue/nr_requests;	<br />
	let i++;<br />
	log -p i -t volume "increases it's cache size $rep";<br />
done;<br />
<br />
<br />
#MTD=`ls -d /sys/block/mtd*`;<br />
#LOOP=`ls -d /sys/block/loop*`;<br />
#MMC=`ls -d /sys/block/mmc*`;<br />
#for j in $MTD $LOOP;<br />
#do<br />
#	echo "0" > $j/queue/rotational;<br />
#	echo "1024" > $j/queue/read_ahead_kb;<br />
#done;<br />
#for a in $MTD $MMC;<br />
#do<br />
#	echo "512" > $a/queue/nr_requests;<br />
#done;<br />
# JACK_ON=`cat /sys/class/switch/h2w/state`;<br />
<br />
<br />
# Switch CPU frequency to lowest in sleep mode<br />
CUR_MAX_CPU=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`;<br />
<br />
<br />
(while [ 1 ]; <br />
do<br />
	AWAKE=`cat /sys/power/wait_for_fb_wake`;<br />
	if [ $AWAKE = "awake" ]; then<br />
		echo $CUR_MAX_CPU > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;<br />
		echo 216000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;<br />
<br />
		echo 5000 > /proc/sys/vm/dirty_expire_centisecs;<br />
		echo 1500 > /proc/sys/vm/dirty_writeback_centisecs;<br />
<br />
		log -p i -t screenstate_scaling "AWAKE -> switching max CPU frequency $CUR_MAX_CPU Mhz";<br />
	fi<br />
<br />
<br />
 <br />
	SLEEP=`cat /sys/power/wait_for_fb_sleep`;<br />
	CUR_MAX_CPU=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`;<br />
	if [ $SLEEP = "sleeping" ]; then<br />
		echo 216000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;<br />
		echo 216000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;	<br />
		<br />
		echo 40000 > /proc/sys/vm/dirty_expire_centisecs;<br />
		echo 60000 > /proc/sys/vm/dirty_writeback_centisecs;<br />
<br />
		#free pagecache, dentries and inodes:<br />
		echo 3 > /proc/sys/vm/drop_caches<br />
<br />
		log -p i -t screenstate_scaling "SLEEP -> switching max CPU frequency 216 Mhz";<br />
	fi<br />
	<br />
	sleep 2;	<br />
done &);<br />
 

·
Registered
Joined
·
55 Posts
I know I have not been here for a bit. Wondering if I should keep going or not? There were only 20some downloads and I had a mistake in the zimage packaging that no one caught. So....I am wondering if anyone really wants to keep going here?
Hmm, what mistake in the zImage packaging? I was trying that out today and had issues booting...
 

·
FW Developer
Joined
·
745 Posts
Discussion Starter · #51 ·
Hmm, what mistake in the zImage packaging? I was trying that out today and had issues booting...
The mistake has since been fixed but the instructions said not to move the ramdisk to the boot directory. This would not work since the perl repackaging script is in the boot directory.
 

·
Registered
Joined
·
55 Posts
The mistake has since been fixed but the instructions said not to move the ramdisk to the boot directory. This would not work since the perl repackaging script is in the boot directory.
Ahh, yeah. I did spot that, but didn't think to report back here. Guess I need to make sure to report back any findings, no matter how small
 

·
FW Developer
Joined
·
745 Posts
Discussion Starter · #53 ·
Ahh, yeah. I did spot that, but didn't think to report back here. Guess I need to make sure to report back any findings, no matter how small
That's ok I just didn't know if there was still interest in this. I will start adding more over next few days.

Sent from my HERO200 using Tapatalk
 

·
Premium Member
Joined
·
825 Posts
I hope someone is smart enough to help me with this one. I am running Ubuntu 11.04 and attempting to repack an unpacked boot.img. I attempted as a regular user and then I switched to the "root" user. I am able to successfully unpack it fine. Here is the error I get during repack.

Code:
Can't exec "./mkbootimg": Permission denied at repack-bootimg.pl line 19.
To put this in context for those who need it.
Code:
[email protected]:~/Desktop/bootimg# perl unpack-bootimg.pl boot.img<br />
<br />
kernel written to boot.img-kernel.gz<br />
ramdisk written to boot.img-ramdisk.cpio.gz<br />
1880 blocks<br />
<br />
extracted ramdisk contents to directory boot.img-ramdisk/<br />
[email protected]:~/Desktop/bootimg# mv boot.img-kernel.gz boot.img-ramdisk boot/<br />
[email protected]:~/Desktop/bootimg# cd boot<br />
[email protected]:~/Desktop/bootimg/boot# perl repack-bootimg.pl boot.img-kernel.gz boot.img-ramdisk boot.img<br />
1880 blocks<br />
Can't exec "./mkbootimg": Permission denied at repack-bootimg.pl line 19.<br />
<br />
repacked boot image written at boot.img-ramdisk-repack.img<br />
[email protected]:~/Desktop/bootimg/boot#
Thanks for the help
 

·
FW Developer
Joined
·
745 Posts
Discussion Starter · #55 ·
I hope someone is smart enough to help me with this one.

Thanks for the help
I don't know if I am but I will give it my best.

Code:
system ("./mkbootimg --kernel $ARGV[0] --ramdisk ramdisk-repack.cpio.gz -o $ARGV[2]");
Is line 19 that is failing.

You do not need to be root. In fact I think it may give you problems bootimg the image if you are.

right click mkbootimg and make sure "allow executing of program" is selected.

also make sure there are no spaces in your path to the file.

Example

/Desktop/'my files'/android would need to be
/Desktop/myfiles/android

Let me know if this works
 

·
Premium Member
Joined
·
825 Posts
I don't know if I am but I will give it my best.

Code:
system ("./mkbootimg --kernel $ARGV[0] --ramdisk ramdisk-repack.cpio.gz -o $ARGV[2]");
Is line 19 that is failing.

You do not need to be root. In fact I think it may give you problems bootimg the image if you are.

right click mkbootimg and make sure "allow executing of program" is selected.

also make sure there are no spaces in your path to the file.

Example

/Desktop/'my files'/android would need to be
/Desktop/myfiles/android

Let me know if this works
Thanks so much for this! it worked great. Now time to start tinkering with injecting some other kernels into flashback.
 

·
Registered
Joined
·
3 Posts
Guys... just starting with Android.. but I've solid 10+ years experience in Linux, comfortable with Eclipse... Downloading the android sdk, and I might need a walk through the basics to start helping...
 
41 - 58 of 58 Posts
Top